Example #1
0
        public async Task <IActionResult> Create([Bind("Id,ClassificacaoId,Detalhamento,RendaMensal,AdultosMoramComVoce,AdultosTemRenda,AdultosRenda,Email,Telefone")] Solicitacao solicitacao)
        {
            if (ModelState.IsValid)
            {
                _context.Add(solicitacao);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassificacaoId"] = new SelectList(_context.Classificacao, "Id", "Descricao", solicitacao.ClassificacaoId);
            return(View(solicitacao));
        }
Example #2
0
        public async Task <IActionResult> Index([Bind("Id,ClassificacaoId,Detalhamento,RendaMensal,AdultosMoramComVoce,AdultosTemRenda,AdultosRenda")] Solicitacao solicitacao)
        {
            var x = _context.Classificacao.FirstOrDefault(m => m.Id == solicitacao.ClassificacaoId);

            solicitacao.Classificacao = x;

            ModelState.Remove("Id");

            if (ModelState.IsValid)
            {
                solicitacao.Id = Guid.NewGuid();
                _context.Add(solicitacao);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Documentacoes", new { id = solicitacao.Id }));
            }

            return(View(solicitacao));
        }