Beispiel #1
0
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     var floor = this.Data.Floors.GetById(id.Value);
     if (floor == null)
     {
         return HttpNotFound();
     }
     FloorEditViewModel floorEditViewModel = new FloorEditViewModel
     {
         HouseId = floor.HouseId,
         Id = floor.Id,
         Name = floor.Name
     };
     return View(floorEditViewModel);
 }
Beispiel #2
0
 public ActionResult Edit(FloorEditViewModel floorEditViewModel)
 {
     if (ModelState.IsValid)
     {
         Floor floor = this.Data.Floors.GetById(floorEditViewModel.Id);
         if (floor == null)
         {
             return HttpNotFound();
         }
         floor.Name = floorEditViewModel.Name;
         this.Data.Floors.Update(floor);
         this.Data.SaveChanges();
         return RedirectToAction("List", "Floors", new { HouseId = floor.HouseId });
     }
     return View(floorEditViewModel);
 }