public async Task <CustomerDto> GetAsync(int id) { var customerResult = await _customerService.GetCustomersAsync(); var customer = customerResult.FirstOrDefault(x => x.Id == id); return(CustomerTranslator.Translate(customer)); }
/// <summary> /// /// </summary> /// <param name="customer"></param> /// <returns></returns> public CustomerDto Put([ModelBinder] Customer customer) { customer = _customerService.UpdateCustomer(customer); return(CustomerTranslator.Translate(customer)); }
public CustomerDto Post([ModelBinder] Customer customer) { _customerService.SaveCustomer(customer); return(CustomerTranslator.Translate(customer)); }
///// <summary> ///// Get Customer By Id. ///// </summary> ///// <param name="id">Customer Id, Type Int</param> ///// <returns>Customer</returns> public CustomerDto Get(int id) { var customer = _customerService.GetCustomers().FirstOrDefault(x => x.Id == id); return(CustomerTranslator.Translate(customer)); }
public async Task <CustomerDto> PutAsync(Customer customer) { customer = await _customerService.UpdateCustomerAsync(customer); return(CustomerTranslator.Translate(customer)); }
public async Task <CustomerDto> PostAsync([ModelBinder] Customer customer) { await _customerService.SaveCustomerAsync(customer); return(CustomerTranslator.Translate(customer)); }