public async Task <IActionResult> Post([FromBody] DtoRelocationPossibility dto) { var entity = Mapper.Map <RelocationPossibility>(dto); _context.RelocationPossibilities.Add(entity); await _context .SaveChangesAsync() .ConfigureAwait(false); return(Ok(entity.Id)); }
public async Task <IActionResult> Update([FromBody] DtoRelocationPossibility dto, [FromRoute] long id) { var template = Mapper.Map <RelocationPossibility>(dto); template.Id = id; await _context.RelocationPossibilities .Where(x => x.Id == id) .UpdateFromQueryAsync(_ => template) .ConfigureAwait(false); return(Ok(id)); }