public async Task <ActionResult <Dtos.Task> > Create([FromBody] Dtos.Task dto) { var entity = new Entities.Task(); TaskMapper.UpdateEntity(dto, entity); await _repository.SaveAsync(entity); dto = TaskMapper.ToDto(entity); return(CreatedAtAction(nameof(Get), new { id = dto.Id }, dto)); }
public async Task <ActionResult> Update(Guid id, [FromBody] Dtos.Task dto) { var entity = await _repository.GetAsync(id); if (entity == null) { return(NotFound()); } TaskMapper.UpdateEntity(dto, entity); await _repository.SaveAsync(entity); dto = TaskMapper.ToDto(entity); return(Ok()); }