Ejemplo n.º 1
0
        public ActionResult Cadastro(string id) //guid
        {
            try
            {
                if (string.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("Listagem"));
                }

                var postEntity = _postService.BuscarPorGuid(id);

                if (postEntity == null)
                {
                    return(Json(new
                    {
                        message = "Post não encontrado para realizar a operação. Tente mais tarde.",
                        result = "ERRO",
                    }, JsonRequestBehavior.AllowGet));
                }

                PostModelCadastro model = new PostModelCadastro();

                if (postEntity != null)
                {
                    model = _postService.Parse_EntityToModel(postEntity);
                }

                if (model.Status_Post != ConstantesStatus.NOVO_POST)
                {
                    model.Bloquear_Botoes_De_Acoes = true;
                }

                return(View(model));
            }
            catch (Exception)
            {
                return(MensagemDeErro());
            }
        }