public ActionResult Add(RoomDTO room)
        {
            List<HotelDTO> hotels = hotelService.GetAll().ToList();
            hotels.Insert(0, new HotelDTO() { Id = 0, Name = String.Empty });
            SelectList hotelList;

            if (room == null || TempData["HotelSelectedId"] == null)
            {
                hotelList = new SelectList(hotels, "Id", "Name");
                room = new RoomDTO();
            }
            else
            {
                hotelList = new SelectList(hotels, "Id", "Name", TempData["HotelSelectedId"]);
                ViewBag.ValidationError = TempData["ValidationError"];
            }
            ViewBag.HotelList = hotelList;

            //List<RoomType> roomTypes = roomTypeRepository.Get("Name (MaxOccupants)").ToList();
            List<RoomTypeDTO> roomTypes = roomTypeService.GetAll().ToList();
            roomTypes.Insert(0, new RoomTypeDTO() { Id = 0, Name = String.Empty });
            SelectList roomTypeList;
            if (room == null || TempData["RoomTypeSelectedId"] == null)
            {
                roomTypeList = new SelectList(roomTypes, "Id", "Name");
                room = new RoomDTO();
            }
            else
            {
                roomTypeList = new SelectList(roomTypes, "Id", "Name", TempData["RoomTypeSelectedId"]);
                ViewBag.ValidationError = TempData["ValidationError"];
            }
            ViewBag.RoomTypeList = roomTypeList;

            return View(room);
        }
        public ActionResult Create(RoomDTO room)
        {
            string error = ""; // roomRepository.ValidateSave(room);

            if (error.Length == 0)
            {
                roomService.Save(room);
                return RedirectToAction("Success", "Room", new { message = "Successfully saved the Room." });
            }
            else
            {
                TempData["ValidationError"] = error;
                TempData["HotelSelectedId"] = room.Hotel.Id;
                TempData["RoomTypeSelectedId"] = room.RoomType.Id;
                return RedirectToAction("Add", "Room", room);
            }
        }
 public void Save(RoomDTO obj)
 {
     roomRepository.Save(Mapper.Map<RoomDTO, Room>(obj));
 }
        public ActionResult Delete(RoomDTO room, int? id)
        {
            string error = ""; // roomRepository.ValidateDelete(room);

            if (error.Length == 0)
            {
                room = roomService.GetRoom(room.Id);
                roomService.Delete(room);
                return View("Success", (object)"Room deleted successfully.");
            }
            else
            {
                return Redirect((string)ViewData["DeleteReturn"]);
            }
        }
 public void Delete(RoomDTO obj)
 {
     roomRepository.Delete(Mapper.Map<RoomDTO, Room>(obj));
 }