コード例 #1
0
        public ActionResult Create([Bind(Include = "ServiceID,Name")] Service service)
        {
            if (ModelState.IsValid)
            {
                db.Service.Add(service);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(service));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "TypeOfRoomID,Name,SingleBed,TwinBed,DOMBed")] TypeOfRoom typeOfRoom)
        {
            if (ModelState.IsValid)
            {
                db.TypeOfRoom.Add(typeOfRoom);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(typeOfRoom));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "BookingContactID,PersonName,Address,PhoneNumber,Email,RoomID,RoomCount,Messeger,Status")] BookingContact bookingContact)
        {
            if (ModelState.IsValid)
            {
                db.BookingContacts.Add(bookingContact);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.RoomID = new SelectList(db.Room, "RoomID", "Name", bookingContact.RoomID);
            return(View(bookingContact));
        }
コード例 #4
0
        public ActionResult RoomBookingInfo([Bind(Include = "BookingContactID,PersonName,Address,PhoneNumber,Email,RoomID,RoomCount,Messeger,Status")] BookingContact bookingContact)
        {
            if (ModelState.IsValid)
            {
                db.BookingContacts.Add(bookingContact);
                db.SaveChanges();
                return(RedirectToAction("Success", "Order", new { bookingContactID = bookingContact.BookingContactID }));
            }
            var room = db.Room.Find(bookingContact.RoomID);

            ViewBag.Room       = room;
            ViewBag.HotelCover = db.PictureHouse.Where(a => a.HouseID == room.HouseID && a.IsMainPicture == true).FirstOrDefault().Name;
            return(View());
        }
コード例 #5
0
 public ActionResult CreateHouse([Bind(Include = "HouseID,Name,Intro,PhoneNumber,Street,Province,District,Ward,UserID,Payment")] House house)
 {
     if (ModelState.IsValid)
     {
         var UserID = User.Identity.GetUserId();
         house.UserID  = UserID;
         house.Payment = "Cash";
         db.House.Add(house);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Province = new SelectList(db.Provinces, "Name", "Name");
     return(View());
 }
コード例 #6
0
 public ActionResult HomeEdit([Bind(Include = "HomepageID,Hotline,Address,Email,FacebookLink,YoutubeLink,GoogleLink")] Homepage homepage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(homepage).State = EntityState.Modified;
         db.SaveChanges();
         var noti = "Cập Nhật Thành Công!";
         return(RedirectToAction("Header", "Admin", new { Noti = noti }));
     }
     return(View(homepage));
 }