public ActionResult SaveDish(Dish addDish) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); Orm.Dishes.Add(addDish); Orm.SaveChanges(); return(RedirectToAction("ThankYouForDish", "Home", addDish)); }
public ActionResult SaveGuest(Guest addGuest) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); Orm.Guests.Add(addGuest); Orm.SaveChanges(); return(RedirectToAction("RsvpComplete", "Home", addGuest)); }
public ActionResult DeleteDish(int DishID) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); Dish found = Orm.Dishes.Find(DishID); Orm.Dishes.Remove(found); Orm.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteGuest(int GuestID) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); Guest found = Orm.Guests.Find(GuestID); Orm.Guests.Remove(found); Orm.SaveChanges(); return(RedirectToAction("GuestIndex")); }
public ActionResult SaveEditGuest(Guest updateGuest) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); Guest oldGuest = Orm.Guests.Find(updateGuest.GuestID); oldGuest.FirstName = updateGuest.FirstName; oldGuest.LastName = updateGuest.LastName; oldGuest.AttendanceDate = updateGuest.AttendanceDate; oldGuest.EmailAddress = updateGuest.EmailAddress; oldGuest.Guest1 = updateGuest.Guest1; Orm.Entry(oldGuest).State = EntityState.Modified; Orm.SaveChanges(); return(RedirectToAction("GuestIndex")); }
public ActionResult SaveEditDish(Dish updateDish) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); Dish oldDish = Orm.Dishes.Find(updateDish.DishID); oldDish.PersonName = updateDish.PersonName; oldDish.PhoneNumber = updateDish.PhoneNumber; oldDish.DishName = updateDish.DishName; oldDish.DishDescription = updateDish.DishDescription; oldDish.Option = updateDish.Option; Orm.Entry(oldDish).State = EntityState.Modified; Orm.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteGuest(int GuestID) { ShahPartyDBEntities Orm = new ShahPartyDBEntities(); var broughtDish = Orm.Dishes.Where(d => d.GuestID == GuestID); if (broughtDish != null) { foreach (var dish in broughtDish) { Orm.Dishes.Remove(dish); } } Guest found = Orm.Guests.Find(GuestID); Orm.Guests.Remove(found); Orm.SaveChanges(); return(RedirectToAction("GuestIndex")); }