public void Setup() { _projetoForUpdateViewModel = new ProjetoForUpdateViewModel { Id = 1, Nome = "Test" }; }
public async Task <IResult> AtualizarAsync(ProjetoForUpdateViewModel projetoForUpdateVireModel) { var alterarProjetoCommand = _mapper.Map <AlterarProjetoCommand>(projetoForUpdateVireModel); var projetoHandler = new ProjetoHandler(_mapper, _repository); var result = await projetoHandler.Handler(alterarProjetoCommand); return(result); }
public async Task <IResult> Put([FromBody] ProjetoForUpdateViewModel projetoForUpdateVireModel) { try { if (!ValidadeModel(projetoForUpdateVireModel)) { return(ValidationViewModelResult("Não foi possivel alterar projeto", projetoForUpdateVireModel.Notifications)); } var result = await _projetoService.AtualizarAsync(projetoForUpdateVireModel); return(result); } catch (Exception ex) { _logger.Error(ex, "Falha ao atualizar projeto."); return(ErrorResult("Falha ao atualizar projeto")); } }