public ActionResult Create(Waiter waiter)
 {
     if (ModelState.IsValid) {
         waiterRepository.InsertOrUpdate(waiter);
         waiterRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
Esempio n. 2
0
 public void InsertOrUpdate(Waiter waiter)
 {
     if (waiter.Id == default(System.Guid)) {
         // New entity
         waiter.Id = Guid.NewGuid();
         context.Waiters.Add(waiter);
     } else {
         // Existing entity
         context.Entry(waiter).State = EntityState.Modified;
     }
 }