public IHttpActionResult UpdateProperty(int tpid, int contactid, [FromBody] TradingPartnerContactPropertyDto dto) { try { var entity = _tpService.GetContactProperty(tpid, contactid, dto.Id); if (entity == null) { return(NotFound()); } var updatedEntity = _tpService.UpdateContactProperty(tpid, contactid, dto); return(Ok(AutoMapper.Mapper.Map <TradingPartnerContactPropertyDto>(updatedEntity))); } catch (Exception ex) { //LOG //return StatusCode(HttpStatusCode.InternalServerError); return(InternalServerError(new Exception("An unexpected error occured! Please try again later!"))); } }
public TradingPartnerContactPropertyDto UpdateContactProperty(int tpid, int contactid, TradingPartnerContactPropertyDto dto) { var entity = AutoMapper.Mapper.Map <TradingPartnerContactProperty>(dto); _contactPropRepository.Update(entity); return(AutoMapper.Mapper.Map <TradingPartnerContactPropertyDto>(entity)); }