public async Task <IActionResult> AddNewTaskGroup([FromBody] TaskGroupPostDto taskGroupPostDto) { var taskGroupResp = await taskGroupService.AddAsync(taskGroupPostDto); //return CreatedAtAction("GetClient", new { id = taskGroupResp.ID }, mapper.Map<TaskGroupResponseDto>(taskGroupResp)); return(Ok(mapper.Map <TaskGroupResponseDto>(taskGroupResp))); }
public async Task <TaskGroup> AddAsync(TaskGroupPostDto entity) { TaskGroupPostDtoValidator validator = new TaskGroupPostDtoValidator(); ValidationResult results = validator.Validate(entity); if (!results.IsValid) { throw new ValidationException("TaskGroupPostDTO", string.Join(". ", results.Errors)); } return(await _repository.AddAsync(mapper.Map <TaskGroup>(entity))); }