コード例 #1
0
        public ActionResult SaveGuestChanges(Guest updatedGuest)
        {
            JonPartyDBEntities ORM = new JonPartyDBEntities();
            Guest oldGuest         = ORM.Guests.Find(updatedGuest.GuestID);

            oldGuest.FirstName      = updatedGuest.FirstName;
            oldGuest.LastName       = updatedGuest.LastName;
            oldGuest.AttendanceDate = updatedGuest.AttendanceDate;
            oldGuest.EmailAddress   = updatedGuest.EmailAddress;
            oldGuest.PlusOne        = updatedGuest.PlusOne;


            ORM.Entry(oldGuest).State = System.Data.Entity.EntityState.Modified;
            ORM.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult SaveDishChanges(Dish updatedDish)
        {
            JonPartyDBEntities ORM = new JonPartyDBEntities();
            Dish oldDish           = ORM.Dishes.Find(updatedDish.DishID);

            oldDish.PersonName      = updatedDish.PersonName;
            oldDish.PhoneNumber     = updatedDish.PhoneNumber;
            oldDish.DishName        = updatedDish.DishName;
            oldDish.DishDescription = updatedDish.DishDescription;
            oldDish.Options         = updatedDish.Options;



            ORM.Entry(oldDish).State = System.Data.Entity.EntityState.Modified;
            ORM.SaveChanges();
            return(RedirectToAction("DishList"));
        }