Beispiel #1
0
        public void OnPost(int carId)
        {
            this.Vehicle = CarRepsitory.GetVehicle(carId);
            CarId        = carId;

            string[] dateTime = UserRerpository.FindById(this.User.FindFirstValue(ClaimTypes.NameIdentifier))?.BirthDate?.Split('/');
            if (dateTime?.Length == 3)
            {
                Day   = dateTime[0];
                Month = dateTime[1];
                Year  = dateTime[2];
            }



            if (!ModelState.IsValid)
            {
                LoggedUserInfo.Id = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

                LoggedUserInfo.BirthDate = (Day.Length == 2 ? Day : "0" + Day) + "-" +
                                           (Month.Length == 2 ? Month : "0" + Month) + "-" + Year;


                UserRerpository.EditBookingInfo(LoggedUserInfo);
                UserRerpository.Save();
            }
        }
Beispiel #2
0
        public void OnGetAsync(int carId, string endBookingDate, string startBookingDate)
        {
            CarId          = carId;
            LoggedUserInfo = UserRerpository.FindById(this.User.FindFirstValue(ClaimTypes.NameIdentifier));

            this.Vehicle = CarRepsitory.GetVehicle(CarId);

            string changeDateFormat(string date)
            {
                var dateArr = date.Split('-');

                return($"{dateArr[2]}-{dateArr[1]}-{dateArr[0]}");
            }

            EndBookingDate   = changeDateFormat(endBookingDate);
            StartBookingDate = changeDateFormat(startBookingDate);


            totalPrice = Convert.ToDecimal(
                (Convert.ToDateTime(EndBookingDate).Date -
                 Convert.ToDateTime(StartBookingDate).Date)
                .TotalDays + 1) * Vehicle.PricePerDay;



            string[] dateTime = LoggedUserInfo?.BirthDate?.Split('/');
            if (dateTime?.Length == 3)
            {
                Day   = dateTime[0];
                Month = dateTime[1];
                Year  = dateTime[2];
            }
        }
Beispiel #3
0
        public async Task OnGetAsync(int carId, string EndBookingDate, string StartBookingDate)
        {
            CarId = carId;
            await SignInManager.PasswordSignInAsync("Moneim2", "*****@*****.**", false, false);


            LoggedUserInfo = UserRerpository.FindById(this.User.FindFirstValue(ClaimTypes.NameIdentifier));

            this.Vehicle = CarRepsitory.GetVehicle(CarId);

            string[] dateTime = LoggedUserInfo?.BirthDate?.Split('/');
            if (dateTime?.Length == 3)
            {
                Day   = dateTime[0];
                Month = dateTime[1];
                Year  = dateTime[2];
            }
        }