コード例 #1
0
        public IActionResult RegisterExit(ParkingExitModel parkingExit)
        {
            ParkingStayModel parkingStay = _context.ParkingStayList.First(m => m.Id == parkingExit.Id);

            if (parkingStay == null)
            {
                return(Redirect("Index"));
            }

            parkingStay.Exit = parkingExit.Exit;

            GetCurrentPricing(parkingStay);
            parkingStay.TotalValue = _priceCalculator.CalculateTotalValue(parkingStay);

            _context.Entry(parkingStay).State = EntityState.Modified;
            _context.SaveChanges();

            return(RedirectToAction("Payment", "Parking", new { id = parkingStay.Id }));
        }