Exemplo n.º 1
0
        public ActionResult Index(DateTime rentalStartDate, DateTime rentalEndDate, int boardGameId, string boardGameName, int count, string discountCode, string rentalCostPerDay, string imagePath)
        {
            decimal totalCost = reservationService.CaculateTotalCostByBoardGameDiscountCode(discountCode, boardGameId, rentalStartDate, rentalEndDate, decimal.Parse(rentalCostPerDay));

            Session["TotalCost"] = totalCost; //brzydka lata

            DAL.Models.User userFromSession = userService.GetById((int)Session["UserId"]);
            Models.User     user            = new Models.User
            {
                UserId          = userFromSession.UserId,
                FirstName       = userFromSession.FirstName,
                LastName        = userFromSession.LastName,
                Email           = userFromSession.Email,
                PhoneNumber     = userFromSession.PhoneNumber,
                Street          = userFromSession.Street,
                HouseNumber     = userFromSession.HouseNumber,
                ApartmentNumber = userFromSession.ApartmentNumber,
                PostalCode      = userFromSession.PostalCode,
                City            = userFromSession.City
            };

            ViewBag.ImagePath = imagePath;
            Models.Reservation reservation = new Models.Reservation
            {
                RentalStartDate      = rentalStartDate,
                RentalEndDate        = rentalEndDate,
                BoardGameId          = boardGameId,
                Count                = count,
                User                 = user,
                TotalCost            = totalCost,
                BoardGameName        = boardGameName,
                BoardGameIsAvailable = boardGamesService.IsAvailable(boardGameId),
                ImagePath            = imagePath
            };
            return(View(reservation));
        }