public IHttpActionResult CreateContactProperty(int tpid, int contactid, [FromBody] TradingPartnerContactPropertyCreateDto property) { if (property == null) { return(BadRequest("Invalid Property Object!")); } return(Ok(_tpService.AddContactProperty(tpid, contactid, property))); }
public TradingPartnerContactPropertyDto AddContactProperty(int tpid, int contactid, TradingPartnerContactPropertyCreateDto dto) { var entity = AutoMapper.Mapper.Map <TradingPartnerContactProperty>(dto); var contact = _contactRepository.GetById(contactid); entity.Contact = contact; _contactPropRepository.Add(entity); return(AutoMapper.Mapper.Map <TradingPartnerContactPropertyDto>(entity)); }