示例#1
0
 public ActionResult Edit([Bind(Include = "Id,Description")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,ImageUrl,AccommodationId")] Image image)
 {
     if (ModelState.IsValid)
     {
         db.Entry(image).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AccommodationId = new SelectList(db.Accommodations, "Id", "Title", image.AccommodationId);
     return(View(image));
 }
示例#3
0
 public ActionResult Edit([Bind(Include = "Id,ApplicationUserId,AccommodationId,Arrival,Departure,Occupancy,Rating")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AccommodationId = new SelectList(db.Accommodations, "Id", "Title", booking.AccommodationId);
     return(View(booking));
 }
示例#4
0
 public ActionResult Edit([Bind(Include = "Id,ApplicationUserId,Title,Location,Adress,Description,Occupancy,Rooms,Baths,Price,CategoryId")] Accommodation accommodation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(accommodation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Description", accommodation.CategoryId);
     return(View(accommodation));
 }