public ActionResult Create(Product product) { if (ModelState.IsValid) { productRepository.CreateProduct(product); return RedirectToAction("Index"); } return View(product); }
public void DeleteProduct(Product product) { context.Entry(product).State = EntityState.Deleted; context.SaveChanges(); }
public void UpdateProduct(Product product) { context.Entry(product).State = EntityState.Modified; context.SaveChanges(); }
public void CreateProduct(Product product) { context.Entry(product).State = EntityState.Added; context.SaveChanges(); }