public async Task <IActionResult> PutContactType(int id, PublicApi.v1.DTO.ContactType contactType) { if (id != contactType.Id) { return(BadRequest()); } _bll.ContactTypes.Update(PublicApi.v1.Mappers.ContactTypeMapper.MapFromExternal(contactType)); await _bll.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <PublicApi.v1.DTO.ContactType> > PostContactType( PublicApi.v1.DTO.ContactType contactType) { contactType = PublicApi.v1.Mappers.ContactTypeMapper.MapFromBLL( await _bll.ContactTypes.AddAsync(PublicApi.v1.Mappers.ContactTypeMapper.MapFromExternal(contactType))); await _bll.SaveChangesAsync(); contactType = PublicApi.v1.Mappers.ContactTypeMapper.MapFromBLL( _bll.ContactTypes.GetUpdatesAfterUOWSaveChanges( PublicApi.v1.Mappers.ContactTypeMapper.MapFromExternal(contactType))); //return NoContent(); return(CreatedAtAction( nameof(GetContactType), new { version = HttpContext.GetRequestedApiVersion().ToString(), id = contactType.Id }, contactType)); }