public void RoomTypeService_Get_All_RoomType() { // Act var actual = _roomTypeServices.GetAll(); // Assert Assert.AreEqual(4, actual.Count(), "The room count is not correct"); }
public ActionResult CreateRoom() { var roomTypesList = _roomType.GetAll(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <RoomType, RoomTypeViewModel>()).CreateMapper(); var roomTypes = mapper.Map <IEnumerable <RoomType>, List <RoomTypeViewModel> >(roomTypesList); var type = new SelectList(roomTypes, "Id", "Name"); ViewBag.RoomTypes = type; var roomStatusList = _roomStatusServices.GetAll(); var mapperRoomStatus = new MapperConfiguration(cfg => cfg.CreateMap <RoomStatus, RoomStatusViewModel>()) .CreateMapper(); var roomStatuses = mapperRoomStatus.Map <IEnumerable <RoomStatus>, List <RoomStatusViewModel> >(roomStatusList); var roomStatus = new SelectList(roomStatuses, "Id", "Name"); ViewBag.RoomStatuses = roomStatus; return(View()); }
// GET: CustomerRequest public ActionResult CustomerRequest(string errorMessage) { ViewBag.ErrorMessage = errorMessage; var roomTypesList = _roomType.GetAll(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <RoomType, RoomTypeViewModel>()).CreateMapper(); var roomTypes = mapper.Map <IEnumerable <RoomType>, List <RoomTypeViewModel> >(roomTypesList); var type = new SelectList(roomTypes, "Id", "Name"); ViewBag.RoomTypes = type; return(View()); }
public ActionResult Index(string sortOrder, int?roomType, int?status) { var roomsEntity = _roomService.GetAll(); var roomTypes = _roomTypeServices.GetAll().ToList(); var roomStatuses = _roomStatusServices.GetAll().ToList(); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <Room, RoomViewModel>()) .CreateMapper(); var rooms = mapper.Map <IEnumerable <Room>, IEnumerable <RoomViewModel> >(roomsEntity); rooms = SortRoom(sortOrder, rooms); //Filter by room type rooms = FilterRoomsByType(roomType, rooms); //Filter by room status rooms = FilterRoomsByStatus(status, rooms); var roomsListViewModel = new RoomsListViewModel { Rooms = rooms, RoomTypes = new SelectList(roomTypes, "Id", "Name"), Statuses = new SelectList(roomStatuses, "Id", "Name"), SleepsPricesSort = new SelectList(new List <string> { "All", "Price: High to Low", "Price: Low to High", "Sleeps: High to Low", "Sleeps: Low to High" }) }; return(View(roomsListViewModel)); }