示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
            }
        }
示例#7
0
        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);
            }
        }
示例#8
0
        private async void InitializeComboBox()
        {
            var places = await placeService.GetAll();

            foreach (var place in places)
            {
                ResidancePlaceComboBox.Items.Add(Mapping.Mapper.Map <PlaceViewModel>(place));
            }
        }
示例#9
0
        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();
            }
        }
示例#12
0
 public IEnumerable <PlaceDTO> Get()
 {
     return(_placeService.GetAll());
 }
 public IActionResult GetAll()
 {
     return(Ok(_placeService.GetAll()));
 }
示例#14
0
        public async Task <APIResponse <IEnumerable <Place> > > Get()
        {
            var places = await _placeService.GetAll();

            return(new APIResponse <IEnumerable <Place> >(Ok().StatusCode, "", places));
        }
示例#15
0
 public IEnumerable<Place> GetAll()
 {
     return placeService.GetAll();
 }