public async Task <IActionResult> AddTagToTaskAsync(int taskId, string tag, [FromServices] IAddTagToTaskCommand command) { try { var response = await command.ExecuteAsync(taskId, tag); return(Ok(response)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> AddTagToTaskTaskAsync(int taskId, string tag, [FromServices] IAddTagToTaskCommand command) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } TaskResponse response = await command.ExecuteAsync(taskId, tag); return(response == null ? (IActionResult)NotFound("Task Not Found") : Ok(response)); }