Пример #1
0
        public ActionResult Quote()
        {
            // pull in all customers into a CustomerModel list (based on data access model)
            var data = CustomerProcessor.MultipleMultiMap();

            // create a new list of CustomerModel type (based on the UI model)
            List <CustomerViewModel> customers = new List <CustomerViewModel>();

            foreach (var row in data) // take the data access model and map it to the UI model.
            {
                customers.Add(new CustomerViewModel
                {
                    CustomerID  = row.CustomerID,
                    FirstName   = row.FirstName,
                    LastName    = row.LastName,
                    Address     = row.Address,
                    City        = row.City,
                    Province    = row.Province,
                    PostalCode  = row.PostalCode,
                    PhoneNumber = row.PhoneNumber,
                    Email       = row.Email,
                    LeadSource  = row.LeadSource,
                    Status      = row.Status,
                    Notes       = row.Notes,
                    Quote       = row.FinancialData.Quote,
                    FinalPrice  = row.FinancialData.FinalPrice,
                    Commission  = row.FinancialData.Commission
                });
            }

            decimal?total = customers.QuoteTotal();

            ViewBag.Quote = total;

            return(View());
        }