Esempio n. 1
0
        //Create new reservation
        public async Task Create()
        {
            LoggedClient = await _clientService.GetById <ClientModel>(APIService.LoggedUserId);

            string[] totalPrice = TotalPrice.Split('K');
            float.TryParse(totalPrice[0], out float ReservationPrice);

            var newReservationRequest = new ReservationInsertUpdateRequest
            {
                VehicleId      = _vehicleId,
                Active         = true,
                AdditionalInfo = AdditionalInfo,
                Canceled       = false,
                ClientId       = LoggedClient.ClientId,
                DateFrom       = _startDate,
                DateTo         = _endDate,
                CreationDate   = DateTime.Now,
                InsuranceId    = SelectedInsuranceType.InsuranceId,
                Price          = ReservationPrice
            };

            var reservationSuccess = await _reservationService.Insert <ReservationModel>(newReservationRequest);

            if (reservationSuccess != null)
            {
                Application.Current.MainPage = new VehicleOfferView("success", reservationSuccess);
            }
        }