示例#1
0
 public ActionResult Rate([Bind(Include = "BookingId,EventId,CustomerId,EventDate,BookingDate,Status,NumberOfPeople,Remarks,Rating")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(booking));
 }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Address,Email,Phone,Latitude,Longitude")] Location location)
 {
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(location));
 }
示例#3
0
        public ActionResult Edit([Bind(Include = "Id,Name,Description,Optional_Services,BasePrice")] Event @event, HttpPostedFileBase postedFile)
        {
            var myUniqueFileName = string.Format(@"{0}", Guid.NewGuid());

            @event.ImagePath = myUniqueFileName;
            if (ModelState.IsValid)
            {
                string serverPath    = Server.MapPath("~/Uploads/");
                string fileExtension = Path.GetExtension(postedFile.FileName);
                string filePath      = @event.ImagePath + fileExtension;
                @event.ImagePath = filePath;
                postedFile.SaveAs(serverPath + @event.ImagePath);

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