public TrofeuDTO(Trofeu trofeu) : this() { Id = trofeu.Id; IdCase = trofeu.IdCase; Nome = trofeu.Nome; Descricao = trofeu.Descricao; Pontos = trofeu.Pontos; }
public EntregaDeTrofeu(Trofeu trofeu, EntregaDeLicao entregaDeLicao, Resposta resposta) { IdTrofeu = trofeu.Id; IdEntregaDeLicao = entregaDeLicao.Id; if (resposta != null) { IdResposta = resposta.Id; } }
public void Atribuir(AtribuirTrofeuRequest request, Usuario usuario) { Trofeu trofeu = _trofeuRepository.GetById(request.IdTrofeu); if (trofeu == null) { throw new Exception("Troféu não localizado."); } CaseDeNegocio caseDeNegocio = _caseDeNegocioService.ObterPorId(trofeu.IdCase); if (!_caseDeNegocioService.UsuarioEstaAssociadoAoCaseDeNegocioComoProfessor(usuario, caseDeNegocio)) { throw new Exception("Usuário não possui permissão para esta solicitação."); } EntregaDeLicao entregaDeLicao = _entregaDeLicaoRepository.GetById(request.IdEntregaDeLicao); if (entregaDeLicao == null) { throw new Exception("Lição não localizada."); } else if (entregaDeLicao.Licao.IdCase != caseDeNegocio.Id) { throw new Exception("Lição não pode ser associada à este troféu."); } Resposta resposta = null; if (request.IdResposta != null && request.IdResposta > 0) { resposta = _respostaRepository.GetById(request.IdResposta.Value); if (resposta == null) { throw new Exception("Questão não localizada."); } else if (resposta.IdEntregaDeLicao != entregaDeLicao.Id) { throw new Exception("Resposta não associada à lição."); } } EntregaDeTrofeu entregaDeTrofeu = new EntregaDeTrofeu(trofeu, entregaDeLicao, resposta); Adicionar(entregaDeTrofeu); }
public void PreencherEntidade(Trofeu trofeu) { trofeu.Nome = Nome; trofeu.Descricao = Descricao; trofeu.Pontos = Pontos; }
public TrofeuParaAtribuirDTO(Trofeu trofeu) { IdTrofeu = trofeu.Id; Nome = trofeu.Nome; Pontos = trofeu.Pontos; }