public async Task <ActionResult <Customer> > CreateNewCustomer([FromBody] Customer customer) { long id; try { id = await Task.Run(() => m_facade.AddNewCustomer(customer)); } catch (DuplicateDetailsException ex) { return(StatusCode(400, $"{{ error: \"{ex.Message}\" }}")); } customer.Id = id; return(Created($"api/Anonymous/CreateNewCustomer/{id}", JsonConvert.SerializeObject(customer))); }