public void DeleteRoomType(RoomType roomType) { var rooms = RoomService.GetRooms().Where(r => r.RoomType.RoomTypeId == roomType.RoomTypeId).ToArray(); for (int i = 0; i < rooms.Count(); i++) { rooms[i].RoomClass = null; RoomService.UpdateRoom(rooms[i]); } RoomTypeRepository.Delete(roomType); SaveRoomType(); }
public ActionResult Create(CreateViewModel createViewModel) { if (!ModelState.IsValid) { return View(createViewModel); } var roomType = new RoomType() { Name = createViewModel.Name, Description = createViewModel.Description }; RoomTypeService.CreateRoomType(roomType); TempData["RoomTypeId"] = roomType.RoomTypeId; TempData["RoomTypeName"] = roomType.Name; TempData["Message"] = RoomTypesMessage.CreateSuccess; return RedirectToAction("index", "roomtypes"); }
public void UpdateRoomType(RoomType roomType) { RoomTypeRepository.Update(roomType); SaveRoomType(); }
public void CreateRoomType(RoomType roomType) { RoomTypeRepository.Add(roomType); this.SaveRoomType(); }