public ActionResult SearchAvailableCarsByOptions(CarSearchViewModel carSearchViewModel) { CarSearchModel carSearchModel = Mapper.Map <CarSearchModel>(carSearchViewModel); var rentViewModel = carSearchViewModel.rentViewModel; var carDtos = carService.GetCarsByOptions(carSearchModel, rentViewModel.firstDayRent, rentViewModel.lastDayRent); var carViewModels = Mapper.Map <IEnumerable <CarViewModel> >(carDtos); // carSearchViewModel.CarViewModels = carViewModels; carSearchViewModel.BodyTypeDtos = carService.GetAllBodyTypeDtos(); carSearchViewModel.CarClassDtos = carService.GetAllCarClassDtos(); carSearchViewModel.FuelTypeDtos = carService.GetAllFuelTypeDtos(); carSearchViewModel.GearboxTypeDtos = carService.GetAllGearboxTypeDtos(); carSearchViewModel.ManufacturerDtos = carService.GetAllManufacturerDtos(); carSearchViewModel.TransmissionTypeDtos = carService.GetAllTransmissionTypeDtos(); var places = placeService.GetAll(); carSearchViewModel.rentViewModel.Locations = places; carSearchViewModel.rentViewModel.PickUpLocation = places .SingleOrDefault(p => p.Id == carSearchViewModel.rentViewModel.PickUpLocationId); carSearchViewModel.rentViewModel.ReturnLocation = places .SingleOrDefault(p => p.Id == carSearchViewModel.rentViewModel.ReturnLocationId); return(View("CarSearchView", carSearchViewModel)); }
public ActionResult Index() { //throw new System.Exception("Let's log an exception!"); var places = placeService.GetAll(); var rentViewModel = new RentViewModel(); rentViewModel.Locations = places; return(View(rentViewModel)); }
public ActionResult RentCar(int CarDtoId, DateTime firstDayRent, DateTime lastDayRent, int PickUpLocationId, int ReturnLocationId) { var carDto = carService.Get(CarDtoId); carDto.ManufacturerDto = manufacurerService.Get(carDto.ManufacturerId); var numberOfDaysInRent = NumberOfDaysInRent(firstDayRent, lastDayRent); var rentViewModel = new RentViewModel() { firstDayRent = firstDayRent, lastDayRent = lastDayRent, PickUpLocationId = PickUpLocationId, ReturnLocationId = ReturnLocationId, Locations = placeService.GetAll() }; var agreementViewModel = new AgreementViewModel() { CarDto = carDto, CarId = CarDtoId, UserName = User.Identity.Name, NumberOfDays = numberOfDaysInRent, TotalPrice = numberOfDaysInRent * carDto.PricePerDay, DateOfAgreement = DateTime.Now, rentViewModel = rentViewModel }; return(View("RentForm", agreementViewModel)); }
public ActionResult Details(int agreementDtoId) { var agreementDto = rentService.GetAgreementDtoById(agreementDtoId); var agreementViewModel = Mapper.Map <AgreementViewModel>(agreementDto); agreementViewModel.rentViewModel = new RentViewModel(); var deliveryDtos = rentService.GetDeliveriesByAgreementId(agreementDtoId); var deliveryPickUp = deliveryDtos.SingleOrDefault(d => d.IsDeliveryToUser == true); var deliveryReturn = deliveryDtos.SingleOrDefault(d => d.IsDeliveryToUser == false); agreementViewModel.rentViewModel.firstDayRent = deliveryPickUp.DateOfDelivery; agreementViewModel.rentViewModel.PickUpLocationId = deliveryPickUp.PlaceId; agreementViewModel.IsPickUped = deliveryPickUp.IsCompleted; agreementViewModel.rentViewModel.lastDayRent = deliveryReturn.DateOfDelivery; agreementViewModel.rentViewModel.ReturnLocationId = deliveryReturn.PlaceId; agreementViewModel.IsReturned = deliveryReturn.IsCompleted; agreementViewModel.rentViewModel.Locations = placeService.GetAll(); return(View("Details", agreementViewModel)); }
private async Task InitializePlaces() { List <PlaceViewModel> places = (await placeService.GetAll()).Select(x => Mapping.Mapper.Map <PlaceViewModel>(x)).ToList(); foreach (PlaceViewModel place in places) { PlaceComboBox.Items.Add(place); } }
private async Task InitializeComboBox() { IList <Place> places = await placeService.GetAll(); foreach (Place place in places) { ResidancePlaceComboBox.Items.Add(Mapping.Mapper.Map <PlaceViewModel>(place)); } }
private async void InitalizeData() { var places = (await placeService.GetAll()).Select(x => Mapping.Mapper.Map <PlaceViewModel>(x)); foreach (PlaceViewModel place in places) { PlaceComboBox.Items.Add(place); } }
private async void InitializeComboBox() { var places = await placeService.GetAll(); foreach (var place in places) { ResidancePlaceComboBox.Items.Add(Mapping.Mapper.Map <PlaceViewModel>(place)); } }
private async void InitializeData() { var places = (await placeService.GetAll()).Select(x => Mapping.Mapper.Map <PlaceViewModel>(x)); foreach (PlaceViewModel model in places) { PlaceComboBox.Items.Add(model); } NameBox.Text = clinicViewModel.Name; var place = await placeService.GetByPrimaryKey(new Place() { IdPlace = clinicViewModel.IdPlace }); PlaceComboBox.SelectedItem = Mapping.Mapper.Map <PlaceViewModel>(place); }
public ActionResult GetPlaces() { var features = new List <Feature>(); var places = _placeService.GetAll(); foreach (var place in places) { var point = new Point(new Position(place.Location.Y, place.Location.X)); var properties = new Dictionary <string, object>(); properties.Add("id", place.Id); properties.Add("name", (String.IsNullOrEmpty(place.Name) ? "" : place.Name)); properties.Add("placeTypeId", place.PlaceTypeId); var feature = new Feature(point, properties); features.Add(feature); } return(Json(new FeatureCollection(features))); }
private async Task InitializeData() { try { List <PlaceViewModel> places = (await placeService.GetAll()).Select(x => Mapping.Mapper.Map <PlaceViewModel>(x)).ToList(); foreach (PlaceViewModel p in places) { PlaceComboBox.Items.Add(p); } NameBox.Text = clinicViewModel.Name; Place place = await placeService.GetByPrimaryKey(new Place() { IdPlace = clinicViewModel.IdPlace }); PlaceComboBox.SelectedItem = Mapping.Mapper.Map <PlaceViewModel>(place); } catch (Exception) { OperationStatus = new OperationStatus(language.DatabaseError, AlertType.Error); Close(); } }
public IEnumerable <PlaceDTO> Get() { return(_placeService.GetAll()); }
public IActionResult GetAll() { return(Ok(_placeService.GetAll())); }
public async Task <APIResponse <IEnumerable <Place> > > Get() { var places = await _placeService.GetAll(); return(new APIResponse <IEnumerable <Place> >(Ok().StatusCode, "", places)); }
public IEnumerable<Place> GetAll() { return placeService.GetAll(); }