public IEnumerable <Room> GetAllEager() { IEnumerable <Room> rooms = this.GetAll(); IEnumerable <RoomType> roomTypes = _roomTypeRepository.GetAll(); IEnumerable <Equipment> equipment = _equipmentRepository.GetAll(); BindRoomsWithRoomTypes(rooms, roomTypes); BindRoomsWithEquipment(rooms, equipment); return(rooms); }
public EditRoomViewModel(RoomsTabViewModel roomTabViewModel, IRoomTypeRepository roomTypeRepository) { _roomTabViewModel = roomTabViewModel; _roomTypeRepository = roomTypeRepository; RoomTypeValues = _roomTypeRepository.GetAll(); CapacityValues = new List <int> { 1, 2, 3, 4 }; UpdateRoomCommand = new SimpleCommand(c => UpdateRoom()); }
public AddRoomViewModel(RoomsTabViewModel roomTabViewModel, IRoomTypeRepository roomTypeRepository) { _roomTabViewModel = roomTabViewModel; _roomTypeRepository = roomTypeRepository; Room = new Room { Number = 1 }; RoomTypeValues = _roomTypeRepository.GetAll(); CapacityValues = new List <int> { 1, 2, 3, 4 }; AddRoomCommand = new SimpleCommand(c => AddRoom()); }
public IEnumerable <RoomType> GetAll() { List <RoomType> lstroomType = new List <RoomType>(); try { lstroomType = _roomTypeRepository.GetAll().Where(x => x.Status == true) .ToList(); } catch (Exception ex) { string FunctionName = string.Format("GetRoomtype('{0}')"); Common.Logs.LogCommon.WriteError(ex.ToString(), FunctionName); return(null); } return(lstroomType); }
public async Task <IEnumerable <RoomType> > GetAll() { return(await roomTypeRepository.GetAll()); }
public IEnumerable <RoomType> GetAll() { return(_roomTypeRepository.GetAll()); }
public async Task <SearchResult> Search(SearchRequest request) { var roomTypes = (await roomTypeRepository.GetAll()).ToList(); var roomSearchResults = new List <RoomSearchResult>(); foreach (var roomRequest in request.RoomTypeSearchRequests) { var roomSearchResult = new RoomSearchResult() { Adults = roomRequest.Adults, Children = roomRequest.Children }; var searchModel = new SearchModel() { CheckinDate = request.CheckInDate, CheckoutDate = request.CheckOutDate, NumberofAdults = roomRequest.Adults, NumberofChildren = roomRequest.Children }; var rooms = new List <RoomTypeSearchResultWithPricesList>(); var roomTypeSearchResults = (await roomTypeRepository.Search(searchModel)).ToList(); foreach (var roomTypeSearchResult in roomTypeSearchResults) { var prices = new List <RoomPriceSearchResult>(); foreach (var date in EachDate(request.CheckInDate, request.CheckOutDate.AddDays(-1))) { foreach (var roomType in roomTypes) { if (roomType.RoomTypeId == roomTypeSearchResult.RoomTypeId) { float discountRates = await promotionRepository.GetAvailablePromotionForDateAndRoomId(new GetAvailablePromotionForDateAndRoomIdRequest() { Date = date, RoomTypeId = roomTypeSearchResult.RoomTypeId }); prices.Add(new RoomPriceSearchResult() { Date = date, Price = (int)(roomType.DefaultPrice * (1 - discountRates)) }); } } } rooms.Add(new RoomTypeSearchResultWithPricesList() { RoomTypeId = roomTypeSearchResult.RoomTypeId, MinRemain = roomTypeSearchResult.MinRemain, RoomPriceSearchResults = prices }); } roomSearchResult.RoomTypeSearchResults = rooms.OrderBy(roomType => roomType.RoomPriceSearchResults.Sum(price => price.Price)); roomSearchResults.Add(roomSearchResult); } var result = new SearchResult() { CheckInDate = request.CheckInDate, CheckOutDate = request.CheckOutDate, RoomSearchResults = roomSearchResults }; return(result); }
public async Task <List <RoomTypeViewModel> > GetAllRoomTypes() { List <RoomType> models = await _roomTypeRepository.GetAll(); return(_mapper.Map <List <RoomType>, List <RoomTypeViewModel> >(models)); }
public void GetAllTest() { Assert.True(_repository.GetAll().Any()); }
public async Task <RoomViewModel> GetRoomByIdAsync(int id) { RoomViewModel viewModel = new RoomViewModel(); if (id > 0) { Room model = await _roomRepository.GetByIdAsync(id); viewModel = _mapper.Map <Model.ViewModels.RoomViewModel>(model); } viewModel.RoomTypes = _mapper.Map <List <RoomType>, List <RoomTypeViewModel> >(await _roomTypeRepository.GetAll()); return(viewModel); }