diff --git a/.vs/GerenciaProjetos/v15/.suo b/.vs/GerenciaProjetos/v15/.suo index e5c3cb9..8c29b4c 100644 Binary files a/.vs/GerenciaProjetos/v15/.suo and b/.vs/GerenciaProjetos/v15/.suo differ diff --git a/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide b/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide index 198bdeb..66666e6 100644 Binary files a/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide and b/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide-wal b/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide-wal index a8bd619..b316c7f 100644 Binary files a/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide-wal and b/.vs/GerenciaProjetos/v15/Server/sqlite3/storage.ide-wal differ diff --git a/GerenciaProjetos/Controllers/BugsController.cs b/GerenciaProjetos/Controllers/BugsController.cs index 8e63293..e09b713 100644 --- a/GerenciaProjetos/Controllers/BugsController.cs +++ b/GerenciaProjetos/Controllers/BugsController.cs @@ -17,7 +17,7 @@ namespace GerenciaProjetos.Controllers { this.ctx = ctx; - Desenvolvedor dev = ctx.Desenvolvedores.Find(1); + Requisito dev = ctx.Requisitos.Find(1); } public IActionResult Index() diff --git a/GerenciaProjetos/Controllers/DesenvolvedorController.cs b/GerenciaProjetos/Controllers/DesenvolvedoresController.cs similarity index 91% rename from GerenciaProjetos/Controllers/DesenvolvedorController.cs rename to GerenciaProjetos/Controllers/DesenvolvedoresController.cs index 6205c68..a1c599d 100644 --- a/GerenciaProjetos/Controllers/DesenvolvedorController.cs +++ b/GerenciaProjetos/Controllers/DesenvolvedoresController.cs @@ -9,26 +9,26 @@ using GerenciaContext = GerenciaProjetos.Data.GerenciaContext; namespace GerenciaProjetos.Controllers { - public class DesenvolvedorController : Controller + public class DesenvolvedoresController : Controller { private GerenciaContext ctx; - public DesenvolvedorController(GerenciaContext ctx) + public DesenvolvedoresController(GerenciaContext ctx) { this.ctx = ctx; - - Desenvolvedor dev = ctx.Desenvolvedores.Find(1); } public IActionResult Index() { ViewBag.Desenvolvedores = ctx.Desenvolvedores; - + return View(); } public IActionResult New() { + ViewData["Title"] = "Novo"; + return View("Form"); } @@ -50,6 +50,8 @@ namespace GerenciaProjetos.Controllers public IActionResult Edit(int id) { + ViewData["Title"] = "Editar"; + Desenvolvedor dev = ctx.Desenvolvedores.Find(id); if (dev != null) diff --git a/GerenciaProjetos/Controllers/HomeController.cs b/GerenciaProjetos/Controllers/HomeController.cs index 28aeb65..5d40537 100644 --- a/GerenciaProjetos/Controllers/HomeController.cs +++ b/GerenciaProjetos/Controllers/HomeController.cs @@ -16,14 +16,13 @@ namespace GerenciaProjetos.Controllers public HomeController(GerenciaContext ctx) { this.ctx = ctx; - - Desenvolvedor dev = ctx.Desenvolvedores.Find(1); } public IActionResult Index() { ViewBag.Desenvolvedores = ctx.Desenvolvedores; ViewBag.Projetos = ctx.Projetos; + ViewBag.Requisitos = ctx.Requisitos; return View(); } diff --git a/GerenciaProjetos/Controllers/ProjetosController.cs b/GerenciaProjetos/Controllers/ProjetosController.cs index 60cfb46..9c2ef34 100644 --- a/GerenciaProjetos/Controllers/ProjetosController.cs +++ b/GerenciaProjetos/Controllers/ProjetosController.cs @@ -16,8 +16,6 @@ namespace GerenciaProjetos.Controllers public ProjetosController(GerenciaContext ctx) { this.ctx = ctx; - - Desenvolvedor dev = ctx.Desenvolvedores.Find(1); } public IActionResult Index() @@ -29,6 +27,8 @@ namespace GerenciaProjetos.Controllers public IActionResult New() { + ViewData["Title"] = "Novo"; + return View("Form"); } @@ -50,6 +50,8 @@ namespace GerenciaProjetos.Controllers public IActionResult Edit(int id) { + ViewData["Title"] = "Editar"; + Projeto proj = ctx.Projetos.Find(id); if (proj != null) diff --git a/GerenciaProjetos/Controllers/RequisitosController.cs b/GerenciaProjetos/Controllers/RequisitosController.cs index 1ed3c7a..cf1b55e 100644 --- a/GerenciaProjetos/Controllers/RequisitosController.cs +++ b/GerenciaProjetos/Controllers/RequisitosController.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using GerenciaProjetos.Models; using GerenciaContext = GerenciaProjetos.Data.GerenciaContext; +using Microsoft.AspNetCore.Mvc.Rendering; namespace GerenciaProjetos.Controllers { @@ -16,13 +17,100 @@ namespace GerenciaProjetos.Controllers public RequisitosController(GerenciaContext ctx) { this.ctx = ctx; - - Desenvolvedor dev = ctx.Desenvolvedores.Find(1); } public IActionResult Index() { + ViewBag.Requisitos = ctx.Requisitos; + return View(); } + + public IActionResult New() + { + ViewData["Title"] = "Novo"; + + ViewBag.Projetos = ctx.Projetos.OrderBy(p => p.Nome).Select(p => new SelectListItem + { + Text = p.Nome, + Value = p.Id.ToString() + }); + + return View("Form"); + } + + [HttpPost] + public IActionResult New(Requisito req) + { + if (ModelState.IsValid) + { + req.DataCadastro = DateTime.Now; + + ctx.Requisitos.Add(req); + ctx.SaveChanges(); + + return RedirectToAction("Index", "Home"); + } + else + { + return View("Form", req); + } + } + + public IActionResult Edit(int id) + { + ViewData["Title"] = "Editar"; + + ViewBag.Projetos = ctx.Projetos.OrderBy(p => p.Nome).Select(p => new SelectListItem + { + Text = p.Nome, + Value = p.Id.ToString() + }); + + Requisito req = ctx.Requisitos.Find(id); + + if (req != null) + { + return View("Form", req); + } + else + { + return RedirectToAction("Index", "Home"); + } + } + + [HttpPost] + [ValidateAntiForgeryToken] + public IActionResult Edit(Requisito req) + { + if (ModelState.IsValid) + { + ctx.Entry(req).Property(r => r.Descricao).IsModified = true; + ctx.Entry(req).Property(r => r.Observacoes).IsModified = true; + ctx.Entry(req).Property(r => r.ProjetoId).IsModified = true; + ctx.Entry(req).Property(r => r.DataEntrega).IsModified = true; + + ctx.SaveChanges(); + + return RedirectToAction("Index", "Home"); + } + else + { + return View("Form", req); + } + } + + public IActionResult Del(int id) + { + Requisito req = ctx.Requisitos.Find(id); + + if (req != null) + { + ctx.Requisitos.Remove(req); + ctx.SaveChanges(); + } + + return RedirectToAction("Index", "Home"); + } } } \ No newline at end of file diff --git a/GerenciaProjetos/Models/Bug.cs b/GerenciaProjetos/Models/Bug.cs index 893c224..336b07d 100644 --- a/GerenciaProjetos/Models/Bug.cs +++ b/GerenciaProjetos/Models/Bug.cs @@ -10,7 +10,7 @@ namespace GerenciaProjetos.Models public class Bug { public int DesenvolvedorId { get; set; } - public Desenvolvedor Desenvolvedor { get; set; } + public Requisito Desenvolvedor { get; set; } public int RequisitoId { get; set; } public Requisito Requisito { get; set; } @@ -20,7 +20,7 @@ namespace GerenciaProjetos.Models public DateTime DataCadastro { get; set; } public int CriadorId { get; set; } - public Desenvolvedor Criador { get; set; } + public Requisito Criador { get; set; } public bool FoiResolvido { get; set; } } diff --git a/GerenciaProjetos/Models/DesenvolvedorProjeto.cs b/GerenciaProjetos/Models/DesenvolvedorProjeto.cs index c5cb350..c96fda6 100644 --- a/GerenciaProjetos/Models/DesenvolvedorProjeto.cs +++ b/GerenciaProjetos/Models/DesenvolvedorProjeto.cs @@ -10,7 +10,7 @@ namespace GerenciaProjetos.Models public class DesenvolvedorProjeto { public int DesenvolvedorId { get; set; } - public Desenvolvedor Desenvolvedor { get; set; } + public Requisito Desenvolvedor { get; set; } public int ProjetoId { get; set; } public Projeto Projeto { get; set; } diff --git a/GerenciaProjetos/Models/DesenvolvedorRequisito.cs b/GerenciaProjetos/Models/DesenvolvedorRequisito.cs index 9a398b6..cce720c 100644 --- a/GerenciaProjetos/Models/DesenvolvedorRequisito.cs +++ b/GerenciaProjetos/Models/DesenvolvedorRequisito.cs @@ -10,7 +10,7 @@ namespace GerenciaProjetos.Models public class DesenvolvedorRequisito { public int DesenvolvedorId { get; set; } - public Desenvolvedor Desenvolvedor { get; set; } + public Requisito Desenvolvedor { get; set; } public int RequisitoId { get; set; } public Requisito Requisito { get; set; } diff --git a/GerenciaProjetos/Views/Desenvolvedor/Form.cshtml b/GerenciaProjetos/Views/Desenvolvedores/Form.cshtml similarity index 87% rename from GerenciaProjetos/Views/Desenvolvedor/Form.cshtml rename to GerenciaProjetos/Views/Desenvolvedores/Form.cshtml index 3136129..87dcb67 100644 --- a/GerenciaProjetos/Views/Desenvolvedor/Form.cshtml +++ b/GerenciaProjetos/Views/Desenvolvedores/Form.cshtml @@ -1,13 +1,11 @@ @{ - ViewData["Title"] = "Novo Desenvolvedor"; Layout = "~/Views/Shared/_Layout.cshtml"; } @model GerenciaProjetos.Models.Desenvolvedor
Subtitulo.
Subtitulo.
Subtitulo.
Use this page to detail your site's privacy policy.
Subtitulo.
Subtitulo.
Subtitulo.
\r\n\r\nSubtitulo.
Subtitulo.
\r\n\r\nUse this page to detail your site\'s privacy policy.
\r\n\r\nSubtitulo.
\r\n\r\nSubtitulo.
# | +Descrição | +Observações | +Data de Cadastro | +Data de Entrega | +Opções | +
---|---|---|---|---|---|
"); + EndContext(); + BeginContext(1320, 4, false); +#line 40 "C:\Users\GuiNerd\source\repos\GerenciaProjetos\GerenciaProjetos\Views\Requisitos\Index.cshtml" + Write(r.Id); + +#line default +#line hidden + EndContext(); + BeginContext(1324, 35, true); + WriteLiteral(" | \r\n"); + EndContext(); + BeginContext(1360, 11, false); +#line 41 "C:\Users\GuiNerd\source\repos\GerenciaProjetos\GerenciaProjetos\Views\Requisitos\Index.cshtml" + Write(r.Descricao); + +#line default +#line hidden + EndContext(); + BeginContext(1371, 35, true); + WriteLiteral(" | \r\n"); + EndContext(); + BeginContext(1407, 13, false); +#line 42 "C:\Users\GuiNerd\source\repos\GerenciaProjetos\GerenciaProjetos\Views\Requisitos\Index.cshtml" + Write(r.Observacoes); + +#line default +#line hidden + EndContext(); + BeginContext(1420, 35, true); + WriteLiteral(" | \r\n"); + EndContext(); + BeginContext(1456, 14, false); +#line 43 "C:\Users\GuiNerd\source\repos\GerenciaProjetos\GerenciaProjetos\Views\Requisitos\Index.cshtml" + Write(r.DataCadastro); + +#line default +#line hidden + EndContext(); + BeginContext(1470, 35, true); + WriteLiteral(" | \r\n"); + EndContext(); + BeginContext(1506, 13, false); +#line 44 "C:\Users\GuiNerd\source\repos\GerenciaProjetos\GerenciaProjetos\Views\Requisitos\Index.cshtml" + Write(r.DataEntrega); + +#line default +#line hidden + EndContext(); + BeginContext(1519, 65, true); + WriteLiteral(" | \r\n\r\n ");
+ EndContext();
+ BeginContext(1584, 177, false);
+ __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "70a16f0fc0b05ca7fcad86a13636925bc2e6a5ba10579", async() => {
+ BeginContext(1666, 91, true);
+ WriteLiteral("\r\n \r\n ");
+ EndContext();
+ }
+ );
+ __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper | \r\n