Ejemplo n.º 1
0
 public ActionResult AddRoom(AddRoomViewModel addRoomModel,int categoryId)
 {
     if (!ModelState.IsValid) return RedirectToAction("AddRoom");
     Service.DTO.RoomModel room = new Service.DTO.RoomModel()
                                             { RoomNumber = addRoomModel.RoomNumber,
                                               TheCategory = new Service.DTO.CategoryModel() { Id=categoryId}
                                             };
     categoryService.AddRoom(room);
     return RedirectToAction("Room");
 }
Ejemplo n.º 2
0
 public ActionResult AddRoom()
 {
     AddRoomViewModel addRoomModel = new AddRoomViewModel();
     List<SelectListItem> listItems = new List<SelectListItem>();
     IEnumerable<Service.DTO.CategoryModel> categories = categoryService.GetAllCategories().ToList();
     foreach(Service.DTO.CategoryModel category in categories)
     {
         listItems.Add(new SelectListItem() { Text = category.Name, Value = category.Id.ToString() });
     }
     addRoomModel.Categories = listItems;
     return View(addRoomModel);
 }