예제 #1
0
        public ActionResult Edit(HttpPostedFileBase[] files, [Bind(Include = "RoomType_id,RType,Descriptions,Images,Views,Bed,MaxPerson,Size")] ROOMTYPE rOOMTYPE)
        {
            List <string> listImg = new List <string>();


            if (ModelState.IsValid)
            {
                foreach (HttpPostedFileBase file in files)
                {
                    if (file != null)
                    {
                        string postedFileName = System.IO.Path.GetFileName(file.FileName);
                        var    path           = System.IO.Path.Combine(Server.MapPath("/images/" + postedFileName));
                        listImg.Add(postedFileName);
                        file.SaveAs(path);
                    }
                }
                //rOOMTYPE.Images = string.Join(",", listImg);

                db.Entry(rOOMTYPE).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rOOMTYPE));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Customer_id,CustomerFirstName,CustomerLastName,CustomerTel,CustomerEmail")] CUSTOMER cUSTOMER)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cUSTOMER).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cUSTOMER));
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "PayType_id,PType")] PAYTYPE pAYTYPE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pAYTYPE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pAYTYPE));
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "Room_id,RoomType_id")] ROOM rOOM)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rOOM).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RoomType_id = new SelectList(db.ROOMTYPEs, "RoomType_id", "RType", rOOM.RoomType_id);
     return(View(rOOM));
 }
예제 #5
0
 public ActionResult Edit([Bind(Include = "Booking_id,Check_in_date,Check_out_date,Customer_id,Room_id")] BOOKING bOOKING)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bOOKING).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Customer_id = new SelectList(db.CUSTOMERs, "Customer_id", "CustomerFirstName", bOOKING.Customer_id);
     ViewBag.Room_id     = new SelectList(db.ROOMs, "Room_id", "RoomType_id", bOOKING.Room_id);
     return(View(bOOKING));
 }
예제 #6
0
 public ActionResult Edit([Bind(Include = "Bill_id,Total,BillPay_id,Rent_id,Booking_id")] BILL bILL)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bILL).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BillPay_id = new SelectList(db.BILLPAYs, "BillPay_id", "PayType_id", bILL.BillPay_id);
     ViewBag.Booking_id = new SelectList(db.BOOKINGs, "Booking_id", "Customer_id", bILL.Booking_id);
     ViewBag.Rent_id    = new SelectList(db.RENTs, "Rent_id", "RoomType_id", bILL.Rent_id);
     return(View(bILL));
 }
예제 #7
0
 public ActionResult Edit([Bind(Include = "Rent_id,Price,IsActive,From_Date,To_Date,RoomType_id")] RENT rENT)
 {
     if (ModelState.IsValid)
     {
         /*
          * string td = String.Format("{0:dd/MM/yyyy}", rENT.To_Date);
          * string fd = String.Format("{0:dd/MM/yyyy}", rENT.From_Date);
          *
          * DateTime date = DateTime.ParseExact(td, "MM/dd/yyyy", null);
          * rENT.To_Date = date;
          * date = DateTime.ParseExact(fd, "MM/dd/yyyy", null);
          * rENT.From_Date = date;
          */
         db.Entry(rENT).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RoomType_id = new SelectList(db.ROOMTYPEs, "RoomType_id", "RType", rENT.RoomType_id);
     return(View(rENT));
 }