public async Task <IHttpActionResult> Post(AddressInfoModel address) { try { if (ModelState.IsValid) { var addressInfo = _mapper.Map <AddressInfo>(address); _repo.AddAddress(addressInfo); if (await _repo.SaveChangesAsync()) { return(Created("GetAddress", new { addressInfoId = addressInfo.AddressInfoId })); } } } catch (Exception ex) { return(BadRequest(ex.Message)); } return(BadRequest()); }