public ActionResult Edit([Bind(Include = "Id,Name,Email")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Create([Bind(Include = "Id,Description")] Room room) { if (ModelState.IsValid) { db.Rooms.Add(room); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(room)); }
public bool DeleteStayType(StayType stayType) { var context = new HotelBookingContext(); context.Entry(stayType).State = System.Data.Entity.EntityState.Deleted; return(context.SaveChanges() > 0); }
public bool SaveStayType(StayType stayType) { var context = new HotelBookingContext(); context.StayTypes.Add(stayType); return(context.SaveChanges() > 0); }
public void Remove(int id) { // The Single method below throws an InvalidOperationException // if there is not exactly one room with the specified Id. var room = db.Room.Single(r => r.Id == id); db.Room.Remove(room); db.SaveChanges(); }
public ActionResult Index() { using (var ctx = new HotelBookingContext()) { var hotel = new Hotel() { Name = "Bill Bill" }; ctx.Hotels.Add(hotel); ctx.SaveChanges(); } ViewBag.Title = "Home Page"; return(View()); }
public Customer Add(Customer entity) { db.Add(entity); db.SaveChanges(); return(entity); }
public void Add(Customer entity) { db.Customer.Add(entity); db.SaveChanges(); }
public void Add(Room entity) { db.Room.Add(entity); db.SaveChanges(); }
public void Add(Booking entity) { var newBooking = db.Booking.Add(entity); db.SaveChanges(); }
public void Save() { db.SaveChanges(); }
public Booking Add(Booking entity) { db.Booking.Add(entity); db.SaveChanges(); return(null); }
public Room Add(Room entity) { db.Add(entity); db.SaveChanges(); return(entity); }