public async Task <IActionResult> PutAddress(int id, PublicApi.v1.DTO.Address address) { if (id != address.Id) { return(BadRequest()); } _bll.Addresses.Update(PublicApi.v1.Mappers.AddressMapper.MapFromExternal(address)); await _bll.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <PublicApi.v1.DTO.Address> > PostAddress(PublicApi.v1.DTO.Address address) { _bll.Addresses.Add(PublicApi.v1.Mappers.AddressMapper.MapFromExternal(address)); await _bll.SaveChangesAsync(); return(CreatedAtAction( nameof(GetAddress), new { version = HttpContext.GetRequestedApiVersion().ToString(), id = address.Id }, address)); }