public async Task <Unit> Handle(IniciarProjetoCommand command, CancellationToken cancellationToken) { var projeto = await _repository.ObterAsync(command.Id); projeto.Iniciar(); await _repository.IniciarAsync(projeto); return(Unit.Value); }
public async Task <Unit> Handle(FinalizarProjetoCommand command, CancellationToken cancellationToken) { var projeto = await _repository.ObterAsync(command.Id); projeto.Finalizar(); await _repository.SaveChangesAsync(); return(Unit.Value); }
public async Task <Unit> Handle(AtualizarProjetoCommand command, CancellationToken cancellationToken) { var projeto = await _repository.ObterAsync(command.Id); projeto.Atualizar(command.Titulo, command.Descricao, command.CustoTotal); await _repository.SaveChangesAsync(); return(Unit.Value); }
public async Task <ProjetoDetalheViewModel> Handle(ObterProjetoQuery query, CancellationToken cancellationToken) { var projeto = await _repository.ObterAsync(query.Id); if (projeto == null) { return(null); } var projetoDetailModel = new ProjetoDetalheViewModel( projeto.Id, projeto.Titulo, projeto.Descricao, projeto.CustoTotal, projeto.DataInicio, projeto.DataFinalizado, projeto.Cliente.NomeCompleto, projeto.Freelancer.NomeCompleto); return(projetoDetailModel); }