public async Task <IActionResult> GerarOrdemServico(OrdemViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewData["Departamentos"] = new SGM.Core.DomainObjects.Departamento().GetDepartamentos();
                ViewData["Solicitacao"]   = await _solicitacaoService.ObterPorId((Guid)model.IdSolicitacao);

                return(View(model));
            }

            OrdemViewModel ordem = new OrdemViewModel
            {
                IdSolicitacao   = model.IdSolicitacao,
                IdSolicitante   = _user.ObterUserId(),
                CodDepartamento = model.CodDepartamento,
                Descricao       = model.Descricao,
                Solucao         = string.Empty
            };

            var response = await _ordemService.Adicionar(ordem);

            if (ResponsePossuiErros(response))
            {
                TempData["Erros"]         = ModelState.Values.SelectMany(v => v.Errors.Select(e => e.ErrorMessage)).ToList();
                ViewData["Departamentos"] = new SGM.Core.DomainObjects.Departamento().GetDepartamentos();
                ViewData["Solicitacao"]   = await _solicitacaoService.ObterPorId((Guid)model.IdSolicitacao);

                return(View(model));
            }
            return(RedirectToAction("AtenderSolicitacao", "Departamento"));
        }
        public async Task <IActionResult> GerarOrdemServico(string SolicitacaoId)
        {
            if (!string.IsNullOrEmpty(SolicitacaoId))
            {
                ViewData["Departamentos"] = new SGM.Core.DomainObjects.Departamento().GetDepartamentos();
                ViewData["Solicitacao"]   = await _solicitacaoService.ObterPorId(Guid.Parse(SolicitacaoId));

                var model = new OrdemViewModel
                {
                    IdSolicitacao = Guid.Parse(SolicitacaoId)
                };
                return(View(model));
            }
            return(RedirectToAction("AtenderSolicitacao", "Departamento"));
        }