Acho q acabou

This commit is contained in:
GuiNerd
2019-11-30 15:10:33 -03:00
parent cc389221db
commit b98436187f
39 changed files with 924 additions and 1395 deletions

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using GerenciaProjetos.Models;
using GerenciaContext = GerenciaProjetos.Data.GerenciaContext;
using Microsoft.AspNetCore.Http;
namespace GerenciaProjetos.Controllers
{
@ -20,14 +21,52 @@ namespace GerenciaProjetos.Controllers
public IActionResult Index()
{
ViewBag.Desenvolvedores = ctx.Desenvolvedores;
ViewBag.Projetos = ctx.Projetos;
ViewBag.Requisitos = ctx.Requisitos;
ViewBag.Bugs = ctx.Bugs;
return View();
}
[HttpPost]
public IActionResult Index(Desenvolvedor dev)
{
Desenvolvedor desenvolvedor = ctx.Desenvolvedores.Where(a => a.Email == dev.Email && a.Senha == dev.Senha).FirstOrDefault();
if (desenvolvedor != null)
{
HttpContext.Session.SetInt32("Id", desenvolvedor.Id);
HttpContext.Session.SetString("Email", desenvolvedor.Email);
HttpContext.Session.SetInt32("EAdmin", desenvolvedor.EAdmin ? 1 : 0);
ViewBag.Projeto = ctx.Projetos;
return RedirectToAction("Index", "Dashboard");
}
else
{
ViewBag.Mensagem = "Usuario não encontrado!";
return View();
}
}
public IActionResult Cadastro()
{
return View();
}
[HttpPost]
public IActionResult Cadastro(Desenvolvedor dev)
{
if (ModelState.IsValid)
{
ctx.Desenvolvedores.Add(dev);
ctx.SaveChanges();
return RedirectToAction("Index", "Dashboard");
}
else
{
return View("Form", dev);
}
}
public IActionResult Privacy()
{
return View();