How can I do to call a unique SaveChanges to affect all changes in all repositories that I use? Should I create a class that contains all repositories and a Save method? What's the best way to do it?
I'm trying this:
public ActionResult Create()
{
Product Product = new Product() { Id = 1, Name = "test", Amount = 1 };
if (_productService.Insert(Product))
{
context.SaveChanges();
return View();
}
return RedirectToAction("Index");
}
Is this correct?