Exemple #1
0
        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);
        }
Exemple #2
0
        public ActionResult About(int id)
        {
            TotalSalesByCustomerViewModel tsbcvm = this.customerService.TotalSalesByCustomer(id);

            return(this.View(tsbcvm));
        }