public TradingPartnerContactDto UpdateContact(int tpid, TradingPartnerContactDto dto) { var entity = AutoMapper.Mapper.Map <TradingPartnerContact>(dto); _contactRepository.Update(entity); var updatedEntity = _contactRepository.GetById(entity.Id); return(AutoMapper.Mapper.Map <TradingPartnerContactDto>(updatedEntity)); }
public IHttpActionResult UpdateContact(int tpid, [FromBody] TradingPartnerContactDto dto) { try { var entity = _tpService.GetContact(tpid, dto.Id); if (entity == null) { return(NotFound()); } return(Ok(_tpService.UpdateContact(tpid, dto))); } catch (Exception ex) { //LOG //return StatusCode(HttpStatusCode.InternalServerError); return(InternalServerError(new Exception("An unexpected error occured! Please try again later!"))); } }