Пример #1
0
        // GET: Customers/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer customer = await db.Customers.FindAsync(id);

            if (customer == null)
            {
                return(HttpNotFound());
            }
            return(View(CustomerViewModelCustomerMapper.GetCustomerViewModel(customer)));
        }
Пример #2
0
        // GET: Customers/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer customer = await db.Customers.Include(c => c.Address.State.Country).FirstAsync(x => x.Id == id);

            CustomerViewModel customerDetailsViewModel =
                CustomerViewModelCustomerMapper.GetCustomerViewModel(customer);

            if (customerDetailsViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(customerDetailsViewModel));
        }
Пример #3
0
 private IQueryable <CustomerViewModel> GetAllCustomersViewModels()
 {
     return
         (db.Customers.Include(c => c.Address.State.Country)
          .Select(customer => CustomerViewModelCustomerMapper.GetCustomerViewModel(customer)));
 }