// GET: api/Customers public IEnumerable <CustomerDto> GetCustomers() { var list = _db.Customers; var res = CustomerDto.ConvertToDto(list); return(res); }
public async Task <CustomerDto> PostCustomer(CustomerInput input) { var customer = new CustomerDto(); customer.ConvertToDto(input); _context.Customers.Add(customer); await _context.SaveChangesAsync(); return(customer); }
public IHttpActionResult GetCustomer(int id) { var customer = _db.Customers.Find(id); if (customer == null) { return(NotFound()); } var res = CustomerDto.ConvertToDto(customer); return(Ok(res)); }