public async Task <IHttpActionResult> Post(CustomerInfo customer) { try { if (ModelState.IsValid) { _repo.AddCustomer(customer); if (await _repo.SaveChangesAsync()) { return(Created("GetCustomers", new { customerInfoId = customer.CustomerInfoId })); } } } catch (Exception ex) { return(BadRequest(ex.Message)); } return(BadRequest()); }