public async Task <ActionResult <AreaOfInterest> > PostAreaOfInterest(PublicApi.v1.DTO.AreaOfInterest areaOfInterest) { areaOfInterest = PublicApi.v1.Mappers.AreaOfInterestMapper.MapFromBLL( _bll.AreaOfInterests.Add(PublicApi.v1.Mappers.AreaOfInterestMapper.MapFromExternal(areaOfInterest))); await _bll.SaveChangesAsync(); // get the new id into the object return(CreatedAtAction("GetAreaOfInterest", new { id = areaOfInterest.Id }, areaOfInterest)); }
public async Task <IActionResult> PutAreaOfInterest(int id, PublicApi.v1.DTO.AreaOfInterest areaOfInterest) { if (id != areaOfInterest.Id) { return(BadRequest()); } if (await _bll.AreaOfInterests.FindAsync(id) == null) { return(NotFound()); } _bll.AreaOfInterests.Update(PublicApi.v1.Mappers.AreaOfInterestMapper.MapFromExternal(areaOfInterest)); await _bll.SaveChangesAsync(); return(NoContent()); }