Пример #1
0
 public ActionResult EditRoom(int id)
 {
     EditRoomViewModel model = new EditRoomViewModel();
     model = _homeAdapter.GetEditRoomViewModel(id);
     return View(model);
 }
Пример #2
0
 public EditRoomViewModel GetEditRoomViewModel(int id)
 {
     Room Room = db.Rooms.Find(id);
     EditRoomViewModel model = new EditRoomViewModel();
     model.Kids = db.Kids.ToList();
     model.Room = Room;
     model.RoomName = Room.Name;
     model.KidId = Room.KidId;
     return model;
 }
Пример #3
0
 public ActionResult EditRoom(int id, EditRoomViewModel model)
 {
     _homeAdapter.SaveRoomViewModel(id, model);
     return RedirectToAction("Index");
 }
Пример #4
0
 public void SaveRoomViewModel(int id, EditRoomViewModel model)
 {
     Room Room = db.Rooms.Find(id);
     Room.Name = model.RoomName;
     Room.KidId = model.KidId;
     db.SaveChanges();
 }