public ActionResult Edit(MeatPart meatPart) { using (var context = new ApplicationDbContext()) { context.Entry(meatPart).State = EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index", context.MeatParts.ToList())); } }
public ActionResult Create(MeatPart meatPart) { using (var context = new ApplicationDbContext()) { meatPart.SerialNumber = Guid.NewGuid().ToString(); context.MeatParts.Add(meatPart); context.SaveChanges(); return(RedirectToAction("Index", context.MeatParts.ToList())); } }