mirror of
https://github.com/guilhermewerner/gerencia-projetos
synced 2025-06-16 15:05:39 +00:00
Acho q acabou
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user