// GET: Customer public ActionResult Customers() { var repository = new CustomerRepository(); var model = repository.GetCustomers().Select(c => new CustomerModel { CustomerId = c.CustomerId, FirstName = c.FirstName, LastName = c.LastName, MiddleI = c.MiddleI }).ToList(); return View(model); }
public ActionResult CreateOrder() { var repository = new CustomerRepository(); var customerDictionary = repository.GetCustomers() .Select(c => new {CustomerId = c.CustomerId, CustomerName = c.FirstName + " " + c.LastName}) .ToDictionary(x => x.CustomerId, x => x.CustomerName); var model = new OrderModel { OrderId = Guid.NewGuid(), OrderDateTime = DateTime.Now, CustomerDictionary = customerDictionary }; return View(model); }