Пример #1
0
        public ActionResult Feedback(FormCollection frm)
        {
            if (ModelState.IsValid)
            {
                string email = frm["email"].ToString();

                var q = (from c in db.Clients
                         where c.Email == email
                         select c).ToList();
                if (q.Count() != 0)
                {
                    db.FeedBacks.Add(new FeedBack()
                    {
                        Description = frm["description"].ToString(),
                        ClientID    = q.ElementAt(0).ClientID
                    });



                    db.SaveChanges();
                }
            }

            return(View("Index"));
        }
Пример #2
0
        public ActionResult Photo(Image img, HttpPostedFileBase doc)
        {
            if (ModelState.IsValid && doc != null)
            {
                var filename  = Path.GetFileName(doc.FileName);
                var extension = Path.GetExtension(filename).ToLower();
                if (extension == ".jpg" || extension == ".png")
                {
                    var path = HostingEnvironment.MapPath(Path.Combine("/Content/RoomPictures/", filename));
                    doc.SaveAs(path);
                    img.Img_Path = "/Content/RoomPictures/" + filename;
                    db.Images.Add(img);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Document size must be less then 5MB");
                    return(View(img));
                }
            }
            ModelState.AddModelError("", "Photo is required");

            return(View(img));
        }
Пример #3
0
        public ActionResult Book([Bind(Include = "BookingID,Numberofpeople,Arrival_date,Departure_date,RoomID")]  Booking bok)
        {
            if (ModelState.IsValid)
            {
                db.Bookings.Add(bok);
                db.SaveChanges();
            }

            return(View("ClientInfo"));
        }
Пример #4
0
 public ActionResult ChangeEmailUserInput(string txtEmail)
 {
     if (ModelState.IsValid)
     {
         int     actID = Convert.ToInt16(Session["accid"]);
         Account q     = db.Accounts.Where(e => e.AccountID == actID).FirstOrDefault <Account>();
         q.Email = txtEmail;
         db.SaveChanges();
     }
     return(View("Index"));
 }
Пример #5
0
        private void AddFacility(bool b1, bool b2, bool b3, bool b4, bool b5)
        {
            db.RoomFacilities.Add(new RoomFacility()
            {
                AirCon = b1,

                Tv        = b2,
                Telephone = b3,
                Balcony   = b4,
                Parking   = b5,
            });
            db.SaveChanges();
        }
Пример #6
0
        public void AddRoom()
        {
            db.Rooms.Add(new Room()
            {
                RoomStatus = status,

                Price           = price,
                FacilityID      = facilityID,
                Floor           = floor,
                RoomDescription = roomdescription,
                Size            = size,
            });
            db.SaveChanges();
        }