//GET: Admin/Edit/5 public ActionResult Edit(int?id) { Hotels180625 hotel = new Hotels180625(); hotel = db.Hotels180625.Find(id); return(View(hotel)); }
public ActionResult BookingsOfSpecifichotel(string id) { BookingDetails180625 bookedroom = new BookingDetails180625(); Hotels180625 hotel = new Hotels180625(); return(View(db.BookingDetails180625.Where(x => x.RoomID.ToString() == id || id == null).ToList())); }
public ActionResult Create(string City, string HotelName, string Address, string Description, int Avg_Rate_Per_Night, string PhoneNo1, string PhoneNo2, string Rating, string Email, string Fax) { Hotels180625 hotel = new Hotels180625(); hotel.HotelName = HotelName; hotel.City = City; hotel.Address = Address; hotel.Description = Description; hotel.Avg_Rate_Per_Night = Avg_Rate_Per_Night; hotel.PhoneNo1 = PhoneNo1; hotel.PhoneNo2 = PhoneNo2; hotel.Rating = Rating; hotel.Email = Email; hotel.Fax = Fax; db.Hotels180625.Add(hotel); db.SaveChanges(); ViewBag.Message = "Successfully Added"; return(RedirectToAction("Details")); }
public ActionResult Edit(Hotels180625 hotel) { var std = db.Hotels180625.Where(x => x.HotelID == hotel.HotelID).FirstOrDefault(); std.HotelID = hotel.HotelID; std.City = hotel.City; std.HotelName = hotel.HotelName; std.Address = hotel.Address; std.Description = hotel.Description; std.Avg_Rate_Per_Night = hotel.Avg_Rate_Per_Night; std.PhoneNo1 = hotel.PhoneNo1; std.PhoneNo2 = hotel.PhoneNo2; std.Rating = hotel.Rating; std.Fax = hotel.Fax; if (TryUpdateModel(std)) { db.SaveChanges(); return(RedirectToAction("Details")); } return(View()); }