public void InsertOrUpdate(OrderServed orderserved) { if (orderserved.Id == default(System.Guid)) { // New entity orderserved.Id = Guid.NewGuid(); context.OrderServeds.Add(orderserved); } else { // Existing entity context.Entry(orderserved).State = EntityState.Modified; } }
public ActionResult Create(OrderServed orderserved) { if (ModelState.IsValid) { orderservedRepository.InsertOrUpdate(orderserved); orderservedRepository.Save(); return RedirectToAction("Index"); } else { ViewBag.PossibleWaiters = waiterRepository.All; ViewBag.PossibleRestaurants = restaurantRepository.All; return View(); } }
public void InsertOrUpdate(OrderServed orderserved) { if (orderserved.Id == default(System.Guid)) { // New entity orderserved.Id = Guid.NewGuid(); context.OrderServeds.Add(orderserved); } else { // Existing entity context.Entry(orderserved).State = EntityState.Modified; } }
public ActionResult Edit(OrderServed orderserved) { if (ModelState.IsValid) { orderservedRepository.InsertOrUpdate(orderserved); orderservedRepository.Save(); return(RedirectToAction("Index")); } else { ViewBag.PossibleWaiters = waiterRepository.All; ViewBag.PossibleRestaurants = restaurantRepository.All; return(View()); } }