예제 #1
0
        public async Task <ActionResult> Get(string id)
        {
            var customer = await _customerDetailContext.Execute(id);

            if (customer.Id == null)
            {
                return(NotFound());
            }
            return(new ObjectResult(customer));
        }
예제 #2
0
        public async Task <IActionResult> GetCustomer([FromRoute] string id)
        {
            var customer = await _getCustomerDetailQuery.Execute(id);

            if (customer == null)
            {
                return(NotFound());
            }

            return(Ok(customer));
        }
예제 #3
0
        public async Task <IActionResult> Get(string id)
        {
            var customer = await _getCustomerDetailQuery.Execute(id);

            if (customer == null)
            {
                return(NotFound());
            }

            return(new ObjectResult(customer));
        }
예제 #4
0
        public async Task <CustomerDetailModel> Execute(UpdateCustomerModel model)
        {
            var entity = await _context.Customers.SingleAsync(c => c.CustomerId == model.Id);

            entity.Address      = model.Address;
            entity.City         = model.City;
            entity.CompanyName  = model.CompanyName;
            entity.ContactName  = model.ContactName;
            entity.ContactTitle = model.ContactTitle;
            entity.Country      = model.Country;
            entity.Fax          = model.Fax;
            entity.Phone        = model.Phone;
            entity.PostalCode   = model.PostalCode;

            await _context.SaveChangesAsync();

            return(await _getCustomerDetailQuery.Execute(entity.CustomerId));
        }
예제 #5
0
 public async Task <IActionResult> GetCustomer([FromRoute] string id)
 {
     return(Ok(await _getCustomerDetailQuery.Execute(id)));
 }