public TotalSalesByCustomerViewModel TotalSalesByCustomer(int id) { Customer customer; customer = this.Context.Customers.Find(id); TotalSalesByCustomerViewModel model = new TotalSalesByCustomerViewModel() { BoughtCars = customer.Sales.Count, MoneySpent = customer.Sales.Sum( x => x.Car.Parts.Sum( a => a.Price)), Name = customer.Name }; return(model); }
public ActionResult About(int id) { TotalSalesByCustomerViewModel tsbcvm = this.customerService.TotalSalesByCustomer(id); return(this.View(tsbcvm)); }