public ActionResult DeleteConfirmed(int id) { UserHotel userHotel = db.UserHotels.Find(id); db.UserHotels.Remove(userHotel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Username,Password,Fullname,Email,Address,PhoneNumber")] UserHotel userHotel) { if (ModelState.IsValid) { db.Entry(userHotel).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userHotel)); }
public ActionResult Create([Bind(Include = "Id,Username,Password,Fullname,Email,Address,PhoneNumber")] UserHotel userHotel) { if (ModelState.IsValid) { db.UserHotels.Add(userHotel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userHotel)); }
// GET: UserHotels/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserHotel userHotel = db.UserHotels.Find(id); if (userHotel == null) { return(HttpNotFound()); } return(View(userHotel)); }
public ActionResult UserHotel(UserHotel_Model cat) { UserHotel tblcat = new UserHotel(); tblcat.UserID = cat.UserID; tblcat.HotelID = cat.HotelID; tblcat.Checkindate = cat.Checkindate; tblcat.Checkoutdate = cat.Checkoutdate; tblcat.NumberOfAdultPerson = cat.NumberOfAdultPerson; tblcat.NumberOfChildPerson = cat.NumberOfChildPerson; tblcat.RoomTypeID = cat.RoomTypeID; tblcat.Amount = cat.Amount; tblcat.NumberOfRooms = cat.NumberOfRooms; ViewBag.user = new SelectList(db.UserRegistrations, "UserID", "UserName"); ViewBag.hotel = new SelectList(db.MasterHotelRegistrations, "HotelID", "HotelName"); ViewBag.roomtype = new SelectList(db.MasterRoomTypes, "RoomtypeID", "RoomtypeName"); db.UserHotels.InsertOnSubmit(tblcat); db.SubmitChanges(); return(View()); }
protected override void Seed(Hotel_ExtContext context) { HotelsInfo h = new HotelsInfo { Id = 1, Fullname = "ABC HOTEL", Address = "JL. ABC No.123, Bandung , Jawa Barat", Description = "A cozy hotel located in Bandung. Located near green area of Bandung, Lembang. Make this hotel air so refreshing. With affordable price, ABC Hotel offers a great view, a fresh air and first rate service.", Stars = 4 }; context.HotelInfo.Add(h); UserHotel uh = new UserHotel { Id = 1, Username = "******", Password = "******", Email = "*****@*****.**", Address = "sarijadi", PhoneNumber = 0222001181 }; context.UserHotels.Add(uh); BankAccount hotel = new BankAccount { Id = 1, BankAccountName = "Jayakarta", BankAccountNo = "123456", BankName = "BCA" }; BankAccount pelanggan = new BankAccount { Id = 2, BankAccountName = "Bambang", BankAccountNo = "78910", BankName = "BCA", UserHotelId = 1 }; context.BankAccounts.Add(hotel); context.BankAccounts.Add(pelanggan); Facility f = new Facility { Id = 1, FacilityNo = "a1", FacilityName = "WIFI" }; context.Facilities.Add(f); Room r = new Room { Id = 1, RoomNo = "ab123", RoomName = "ab123", Capacity = "2" }; context.Rooms.Add(r); BedRoomType bt = new BedRoomType { Id = 1, BedRoomTypeCode = "d", BedRoomName = "deluxe", ImageBedroom = "xyz", SizeRoom = 50 }; context.BedRoomTypes.Add(bt); Bedroom b = new Bedroom { Id = 1, BedroomNumber = "abcd123", AvailabilityStatus = 1, BedroomTypeId = 1 }; context.Bedrooms.Add(b); context.SaveChanges(); base.Seed(context); }