public async Task <ActionResult> Get(string id) { var customer = await _customerDetailContext.Execute(id); if (customer.Id == null) { return(NotFound()); } return(new ObjectResult(customer)); }
public async Task <IActionResult> GetCustomer([FromRoute] string id) { var customer = await _getCustomerDetailQuery.Execute(id); if (customer == null) { return(NotFound()); } return(Ok(customer)); }
public async Task <IActionResult> Get(string id) { var customer = await _getCustomerDetailQuery.Execute(id); if (customer == null) { return(NotFound()); } return(new ObjectResult(customer)); }
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)); }
public async Task <IActionResult> GetCustomer([FromRoute] string id) { return(Ok(await _getCustomerDetailQuery.Execute(id))); }