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:
@ -55,7 +55,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.Bugs.Add(bug);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -87,7 +87,7 @@ namespace GerenciaProjetos.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,8 @@ namespace GerenciaProjetos.Controllers
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
ctx.Entry(bug).Property(r => r.DesenvolvedorId).IsModified = true;
|
||||
ctx.Entry(bug).Property(r => r.CriadorId).IsModified = true;
|
||||
ctx.Entry(bug).Property(r => r.SolucionadorId).IsModified = true;
|
||||
ctx.Entry(bug).Property(r => r.RequisitoId).IsModified = true;
|
||||
ctx.Entry(bug).Property(r => r.FoiResolvido).IsModified = true;
|
||||
ctx.Entry(bug).Property(r => r.Descricao).IsModified = true;
|
||||
@ -105,7 +106,7 @@ namespace GerenciaProjetos.Controllers
|
||||
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -123,7 +124,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
}
|
29
GerenciaProjetos/Controllers/DashboardController.cs
Normal file
29
GerenciaProjetos/Controllers/DashboardController.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GerenciaProjetos.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace GerenciaProjetos.Controllers
|
||||
{
|
||||
public class DashboardController : Controller
|
||||
{
|
||||
private GerenciaContext ctx;
|
||||
|
||||
public DashboardController(GerenciaContext ctx)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
ViewBag.Desenvolvedores = ctx.Desenvolvedores;
|
||||
ViewBag.Projetos = ctx.Projetos;
|
||||
ViewBag.Requisitos = ctx.Requisitos;
|
||||
ViewBag.Bugs = ctx.Bugs;
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.Desenvolvedores.Add(dev);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -60,7 +60,7 @@ namespace GerenciaProjetos.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.Desenvolvedores.Update(dev);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
@ -40,7 +40,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.Projetos.Add(proj);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -60,7 +60,7 @@ namespace GerenciaProjetos.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.Projetos.Update(proj);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.Requisitos.Add(req);
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -75,7 +75,7 @@ namespace GerenciaProjetos.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ namespace GerenciaProjetos.Controllers
|
||||
|
||||
ctx.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -112,7 +112,7 @@ namespace GerenciaProjetos.Controllers
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
return RedirectToAction("Index", "Dashboard");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user