public IActionResult Abrir([Bind("ProdutoId,TipoChamadoId,AssuntoChamadoId,Descricao")] AbrirViewModel abrirViewModel) { if (!ModelState.IsValid) { return(NotFound()); } Chamado chamado = new Chamado { Status = Status.Recebido, ClienteId = Convert.ToInt32(UsuarioAutal.GetClienteId(HttpContext)), ProdutoId = abrirViewModel.ProdutoId, TipoChamadoId = abrirViewModel.TipoChamadoId, AssuntoChamadoId = abrirViewModel.AssuntoChamadoId, Descricao = abrirViewModel.Descricao }; HttpResponseMessage response = _httpClient .PostAsJsonAsync(_httpClient.BaseAddress + $"/chamados/", chamado) .Result; if (!response.IsSuccessStatusCode) { ViewBag.mensagemErro = "Não foi possível abrir o chamado"; return(View(abrirViewModel)); } chamado = response.Content.ReadAsAsync <Chamado>().Result; ViewBag.mensagemSucesso = "Chamado aberto com sucesso"; return(RedirectToAction(nameof(Chamado), new { id = chamado.ChamadoId })); }
// GET: chamados public IActionResult Index() { IndexViewModel indexViewModel = new IndexViewModel(); HttpResponseMessage response = new HttpResponseMessage(); if (UsuarioAutal.GetClienteId(HttpContext) != null) { string clienteId = UsuarioAutal.GetClienteId(HttpContext).ToString(); response = _httpClient .GetAsync(_httpClient.BaseAddress + $"/chamados/emaberto/cliente/" + clienteId) .Result; } else if (UsuarioAutal.GetFuncionarioId(HttpContext) != null) { string funcionarioId = UsuarioAutal.GetFuncionarioId(HttpContext).ToString(); response = _httpClient .GetAsync(_httpClient.BaseAddress + $"/chamados/emaberto/funcionario/" + funcionarioId) .Result; } if (!response.IsSuccessStatusCode) { return(NotFound()); } indexViewModel.Chamados = response.Content.ReadAsAsync <IEnumerable <Chamado> >().Result; return(View(indexViewModel)); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(98, 2, true); WriteLiteral("\r\n"); EndContext(); #line 5 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" ViewData["Title"] = "Chamado Nº" + Model.ChamadoId; #line default #line hidden BeginContext(164, 222, true); WriteLiteral("\r\n<div class=\"row\">\r\n <div class=\"col-md-6\">\r\n <div class=\"card\">\r\n <div class=\"card-header\">\r\n <ul class=\"list-inline\">\r\n <li class=\"list-inline-item\"><b>Número:</b> "); EndContext(); BeginContext(387, 23, false); #line 14 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.ChamadoId); #line default #line hidden EndContext(); BeginContext(410, 71, true); WriteLiteral("</li>\r\n <li class=\"list-inline-item\"><b>Status:</b> "); EndContext(); BeginContext(482, 20, false); #line 15 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.Status); #line default #line hidden EndContext(); BeginContext(502, 73, true); WriteLiteral("</li>\r\n <li class=\"list-inline-item\"><b>Abertura:</b> "); EndContext(); BeginContext(576, 49, false); #line 16 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.DataAbertura.ToString("dd/MM/yyyy")); #line default #line hidden EndContext(); BeginContext(625, 258, true); WriteLiteral(@"</li> </ul> </div> <div class=""card-body""> <h5 class=""card-title"">Detalhes do chamado</h5> <dl class=""list-inline""> <dt>Produto</dt> <dd>"); EndContext(); BeginContext(884, 31, false); #line 24 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.Produto.Descricao); #line default #line hidden EndContext(); BeginContext(915, 68, true); WriteLiteral("</dd>\r\n\r\n <dt>Tipo</dt>\r\n <dd>"); EndContext(); BeginContext(984, 35, false); #line 27 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.TipoChamado.Descricao); #line default #line hidden EndContext(); BeginContext(1019, 71, true); WriteLiteral("</dd>\r\n\r\n <dt>Assunto</dt>\r\n <dd>"); EndContext(); BeginContext(1091, 38, false); #line 30 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.AssuntoChamado.Descricao); #line default #line hidden EndContext(); BeginContext(1129, 73, true); WriteLiteral("</dd>\r\n\r\n <dt>Descrição</dt>\r\n <dd>"); EndContext(); BeginContext(1203, 23, false); #line 33 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(Model.Chamado.Descricao); #line default #line hidden EndContext(); BeginContext(1226, 259, true); WriteLiteral(@"</dd> </dl> </div> </div> </div> <div class=""col-md-6 mt-3 mt-md-0""> <ul class=""list-inline""> <li class=""list-inline-item""> <h5>Posicionamentos</h5> </li> "); EndContext(); #line 44 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" if (UsuarioAutal.GetClienteId(Context) != null) { #line default #line hidden BeginContext(1562, 322, true); WriteLiteral(@" <li class=""float-right list-inline-item""> <button type=""button"" class=""ml-md-auto btn btn-sm btn-primary"" data-toggle=""modal"" data-target=""#adicionarPosicionamento""> <i class=""fas fa-plus""></i> ADICIONAR </button> </li> "); EndContext(); #line 52 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" } #line default #line hidden BeginContext(1899, 17, true); WriteLiteral(" </ul>\r\n\r\n"); EndContext(); #line 55 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" foreach (var posicionamentoChamado in Model.Chamado.PosicionamentosChamado) { #line default #line hidden BeginContext(2013, 16, true); WriteLiteral(" <div"); EndContext(); BeginWriteAttribute("class", " class=\"", 2029, "\"", 2124, 3); WriteAttributeValue("", 2037, "card", 2037, 4, true); WriteAttributeValue(" ", 2041, "mt-3", 2042, 5, true); #line 57 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" WriteAttributeValue(" ", 2046, posicionamentoChamado.FuncionarioId != null ? "bg-primary text-white" : "", 2047, 77, false); #line default #line hidden EndWriteAttribute(); BeginContext(2125, 75, true); WriteLiteral(">\r\n <div class=\"card-body\">\r\n <blockquote"); EndContext(); BeginWriteAttribute("class", " class=\"", 2200, "\"", 2281, 2); WriteAttributeValue("", 2208, "blockquote", 2208, 10, true); #line 59 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" WriteAttributeValue(" ", 2218, posicionamentoChamado.ClienteId != null ? "text-right" : "", 2219, 62, false); #line default #line hidden EndWriteAttribute(); BeginContext(2282, 43, true); WriteLiteral(">\r\n <p class=\"mb-0\">"); EndContext(); BeginContext(2326, 31, false); #line 60 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(posicionamentoChamado.Descricao); #line default #line hidden EndContext(); BeginContext(2357, 37, true); WriteLiteral("</p>\r\n <footer"); EndContext(); BeginWriteAttribute("class", " class=\"", 2394, "\"", 2486, 2); WriteAttributeValue("", 2402, "blockquote-footer", 2402, 17, true); #line 61 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" WriteAttributeValue(" ", 2419, posicionamentoChamado.FuncionarioId != null ? "text-white" : "", 2420, 66, false); #line default #line hidden EndWriteAttribute(); BeginContext(2487, 31, true); WriteLiteral(">\r\n "); EndContext(); BeginContext(2519, 63, false); #line 62 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" Write(posicionamentoChamado.DataCadastro.ToString("dd/MM/yyyy HH:ss")); #line default #line hidden EndContext(); BeginContext(2582, 116, true); WriteLiteral("\r\n </footer>\r\n </blockquote>\r\n </div>\r\n </div>\r\n"); EndContext(); #line 67 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" } #line default #line hidden BeginContext(2709, 611, true); WriteLiteral(@" </div> </div> <div id=""adicionarPosicionamento"" class=""modal fade"" tabindex=""-1"" role=""dialog"" aria-labelledby=""adicionarPosicionamento"" aria-hidden=""true""> <div class=""modal-dialog modal-dialog-centered"" role=""document""> <div class=""modal-content""> <div class=""modal-body""> <h5 id=""adicionarPosicionamento"" class=""modal-title"">Adicionar posicionamento</h5> <button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close""> <span aria-hidden=""true"">×</span> </button> "); EndContext(); BeginContext(3320, 816, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "d825345bb9d64f7c8c3494b0ae944b31", async() => { BeginContext(3347, 22, true); WriteLiteral("\r\n "); EndContext(); BeginContext(3369, 66, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "65ba5bc61de64444959e23bc556f8116", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper); #line 81 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper.ValidationSummary = global::Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary.ModelOnly; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-summary", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper.ValidationSummary, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3435, 22, true); WriteLiteral("\r\n "); EndContext(); BeginContext(3457, 64, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "be4746ce1138457892d8911b833f4f6b", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); #line 82 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.ChamadoId); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3521, 22, true); WriteLiteral("\r\n "); EndContext(); BeginContext(3543, 64, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "fd7d751697504121a31e2c84ef9d5c45", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); #line 83 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.ClienteId); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3607, 74, true); WriteLiteral("\r\n\r\n <div class=\"form-group\">\r\n "); EndContext(); BeginContext(3681, 57, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "d77df6e0ef8141e29e1810f0ab408477", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper); #line 86 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Descricao); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3738, 26, true); WriteLiteral("\r\n "); EndContext(); BeginContext(3764, 62, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("textarea", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "34bb8bf5bc244e79a3038d56bd0fe14e", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_TextAreaTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_TextAreaTagHelper); #line 87 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_TextAreaTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Descricao); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_TextAreaTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3826, 26, true); WriteLiteral("\r\n "); EndContext(); BeginContext(3852, 64, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3eeab1247f38446dae99e2774e30b65e", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper); #line 88 "C:\Users\marco\OneDrive\Desktop\Dashboard\Dashboard.MVC\Views\Chamados\Chamado.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Descricao); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(3916, 213, true); WriteLiteral("\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <input type=\"submit\" value=\"Adicionar\" class=\"btn btn-primary\" />\r\n </div>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(4136, 56, true); WriteLiteral("\r\n </div>\r\n </div>\r\n </div>\r\n</div>"); EndContext(); }