public async Task <ActionResult <Customer> > CreateCustomerAsync([FromBody, Required] CustomerInput customer) { var newCustomer = new Customer(customer); try { await context.AddAsync(newCustomer); await context.SaveChangesAsync(); } catch (Exception) { return(BadRequest()); } return(CreatedAtAction("GetCustomer", new { id = newCustomer.Id }, newCustomer)); }