public async Task <ActionResult <TargetAudience> > PostTargetAudience(PublicApi.v1.DTO.TargetAudience targetAudience) { targetAudience = PublicApi.v1.Mappers.TargetAudienceMapper.MapFromBLL( _bll.TargetAudiences.Add(PublicApi.v1.Mappers.TargetAudienceMapper.MapFromExternal(targetAudience))); await _bll.SaveChangesAsync(); // get the new id into the object return(CreatedAtAction("GetTargetAudience", new { id = targetAudience.Id }, targetAudience)); }
public async Task <IActionResult> PutTargetAudience(int id, PublicApi.v1.DTO.TargetAudience targetAudience) { if (id != targetAudience.Id) { return(BadRequest()); } if (await _bll.TargetAudiences.FindAsync(id) == null) { return(NotFound()); } _bll.TargetAudiences.Update(PublicApi.v1.Mappers.TargetAudienceMapper.MapFromExternal(targetAudience)); await _bll.SaveChangesAsync(); return(NoContent()); }