public ActionResult Details(string licensePlate) { Car car = CarRepository.RetrieveByLicensePlate(licensePlate); var viewData = new CarDetailsViewData { Car = car, TotalKilometers = CostsRepository.CalculateTotalKilometers(car), AverageUsage = CostsRepository.CalculateAverageUsage(car), TotalCosts = CostsRepository.CalculateTotalCosts(car), AverageCosts = CostsRepository.CalculateAverageCostsPerKilometer(car) }; return View("Details", viewData); }
public ActionResult Statistics(string licensePlate) { if (!Request.IsAjaxRequest()) { return RedirectToAction("Details", new { licensePlate = licensePlate }); } Car car = CarRepository.RetrieveByLicensePlate(licensePlate); var viewData = new CarDetailsViewData { Car = car, TotalKilometers = CostsRepository.CalculateTotalKilometers(car), AverageUsage = CostsRepository.CalculateAverageUsage(car), TotalCosts = CostsRepository.CalculateTotalCosts(car), AverageCosts = CostsRepository.CalculateAverageCostsPerKilometer(car) }; return View("StatisticsCarDetails", viewData); }