public IActionResult Excluir(int id) { var tarefa = _tarefaRepository.ObterPorId(id); _tarefaRepository.Excluir(id); return(RedirectToAction("Todas", "Tarefa", new { id = tarefa.ProjetoId })); }
public async Task <ActionResult <TarefaViewModel> > ObterPorId(Guid id) { var tarefaViewModel = _mapper.Map <TarefaViewModel>(await _tarefaRepository.ObterPorId(id)); if (tarefaViewModel == null) { return(NotFound()); } return(tarefaViewModel); }
public Task Handle(ExcluirTarefaCommand message, CancellationToken cancellationToken) { if (!TarefaExistente(message.Id, message.MessageType)) { return(Task.FromCanceled(cancellationToken)); } var tarefaAtual = _tarefaRepository.ObterPorId(message.Id); // Validacoes de negocio tarefaAtual.ExcluirTarefa(); _tarefaRepository.Remover(tarefaAtual.Id); if (Commit()) { _mediator.PublicarTarefa(new TarefaExcluidoEvent(message.Id)); } return(Task.CompletedTask); }
public override async Task Atualizar(Tarefa tarefa) { if (!ExecutarValidacao(AbstractValidator, tarefa)) { return; } var tarefaAtualizacao = await _tarefaRepository.ObterPorId(tarefa.Id); tarefaAtualizacao.Titulo = tarefa.Titulo; tarefaAtualizacao.Descricao = tarefa.Descricao; tarefaAtualizacao.EquipeId = tarefa.EquipeId; tarefaAtualizacao.Estado = tarefa.Estado; tarefaAtualizacao.DataUltimaAlteracao = DateTime.UtcNow.Date; await _tarefaRepository.Atualizar(tarefaAtualizacao); }
public Tarefa ObterPorId(int id) => _tarefaRepository.ObterPorId(id);
private async Task <Tarefa> ObterPorId(Guid id) => await tarefaRepository.ObterPorId(id);
public TarefaViewModel Get(long id) { return(_mapper.Map <TarefaViewModel>(_tarefaRepository.ObterPorId(id))); }