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

@ -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");
}
}
}

View 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();
}
}
}

View File

@ -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");
}
}
}

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();

View File

@ -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");
}
}
}

View File

@ -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");
}
}
}