Esempio n. 1
0
        public IActionResult Detail(int id)
        {
            var model = new DetailBookingViewModel();

            try
            {
                model.Vehicle = vehicleDB.Get(new Vehicle {
                    Id = id
                });
                model.Booking = bookingDB.List(new BookingVehicles {
                    Id = id
                });
            }
            catch (Exception ex)
            {
                //loglama
            }

            return(View(model));
        }
        public IActionResult Details(int id)

        {
            var booking = _bookingRepository.GetBooking(id);
            //var car = _carRepository.GetCar(booking.CarId);


            //var currentuser = await _userManager.GetUserAsync(HttpContext.User);
            double Total = 1000;

            //int Days = 0;

            //Days = (booking.EndDate - booking.StartDate).Days;



            //if (Days == 1)
            //{
            //    Total = Days * booking.Car.Prijs;
            //}
            //else if (Days == 2)
            //{
            //    Total = Days * Math.Round((booking.Car.Prijs * 0.8), 0);
            //}
            //else
            //{
            //    Total = Days * booking.Car.Prijs;
            //}
            if (booking != null)
            {
                DetailBookingViewModel model = new DetailBookingViewModel()
                {
                    BookingId        = booking.BookingId,
                    BrandName        = booking.Car.CarModel.Brand.BrandName,
                    ModelName        = booking.Car.CarModel.ModelName,
                    StartDate        = booking.StartDate,
                    EndDate          = booking.EndDate,
                    BookingVanStatus = booking.BookingVanStatus,
                    Prijs            = booking.Car.Prijs,
                    ExistingPhotoCar = booking.Car.PhotoCar,
                    ApplicationUser  = booking.ApplicationUser,
                    Days             = "0",
                    Total            = Total.ToString(),
                    //FirstName = currentuser.FirstName,
                    //LastName = currentuser.LastName,
                    //Email = currentuser.Email,
                    //PhoneNumber = currentuser.PhoneNumber
                    FirstName   = "",
                    LastName    = "",
                    Email       = "",
                    PhoneNumber = ""



                                  //Total = _jours.TotalPrijs.ToString()
                                  //Price = _jours.PricePerHour.ToString(),
                };

                return(View(model));
            }
            ;
            return(View());
        }