public ActionResult Create() { ModifyProductViewModel m = new ModifyProductViewModel(); return(View(m)); }
public ActionResult Edit(ModifyProductViewModel m) { if (ModelState.IsValid) { db.Entry(m.Product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(m.Product)); }
public ActionResult Create(ModifyProductViewModel productViewModel) { if (ModelState.IsValid) { Guid guid = Guid.NewGuid(); productViewModel.Product.ProductId = guid.ToString(); db.Products.Add(productViewModel.Product); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productViewModel)); }