public async Task <AppTaskResponseDto> UpdateAsync(AppTaskRequestDto taskRequestDto) { var task = _mapper.Map <AppTask>(taskRequestDto); var result = await _taskRepo.UpdateAsync(task); var dto = _mapper.Map <AppTaskResponseDto>(result); return(dto); }
public async Task <IActionResult> PostTask(AppTaskRequestDto taskRequestDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var taskResponseDto = await _taskService.AddAsync(taskRequestDto); return(CreatedAtAction(nameof(GetTask), new { id = taskResponseDto.Id }, taskResponseDto)); }
public async Task <AppTaskResponseDto> AddAsync(AppTaskRequestDto taskRequestDto) { var task = _mapper.Map <AppTask>(taskRequestDto); task.UploadDate = DateTime.UtcNow; var result = await _taskRepo.AddAsync(task); var dto = _mapper.Map <AppTaskResponseDto>(result); return(dto); }
public async Task <IActionResult> PutTask(AppTaskRequestDto taskRequestDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var taskResponseDto = await _taskService.UpdateAsync(taskRequestDto) ; return(Ok(taskResponseDto)); }