public object Handler(ToggleTaskCommand command) { var task = _repository.Get(command.Id); task.ToggleCompleted(); _repository.Update(task); _uow.Commit(); return(new { task.Id, task.Completed }); }
public IActionResult Completed(ToggleTaskCommand command) { try { var result = _hander.Handler(command); return(Ok(result)); } catch (Exception) { // tratamento de erros, logs etc... throw; } }