public IEnumerable <InformativoViewModel> ListInformativosByID(InformativoAPIModel value)
        {
            // Validar Token
            Auth a = ValidarToken(value);

            if (a.Code != 0)
            {
                InformativoViewModel informativoViewModel = new InformativoViewModel()
                {
                    mensagem = new Validate()
                    {
                        Code    = 202,
                        Message = "Acesso Negado. Suas credencias não estão autorizadas para executar esta operação."
                    }
                };
                List <InformativoViewModel> ret = new List <InformativoViewModel>
                {
                    informativoViewModel
                };
                return(ret);
            }
            //if (a.Code != 0)
            //    //return new List<InformativoViewModel>();
            //    throw new Exception(a.Mensagem);

            // Listar
            Facade <InformativoViewModel, InformativoModel, ApplicationContext> facade = new Facade <InformativoViewModel, InformativoModel, ApplicationContext>();
            IEnumerable <InformativoViewModel> list = facade.List(new ListViewInformativoByIDAPI(), 0, int.Parse(PageSize), value.Token, value.InformativoID);

            return(list);
        }
        public InformativoViewModel Create(InformativoViewModel value)
        {
            value = (InformativoViewModel)ValidarToken(value);
            if (value.mensagem.Code != 0)
            {
                return(value);
            }

            value.uri = this.ControllerContext.Controller.GetType().Name.Replace("Controller", "") + "/" + this.ControllerContext.RouteData.Values["action"].ToString();
            FactoryLocalhost <InformativoViewModel, ApplicationContext> facade = new FactoryLocalhost <InformativoViewModel, ApplicationContext>();

            return(facade.Execute(new InformativoCadastrarBI(), value, value.sessionId));
        }
        public InformativoViewModel Delete(InformativoViewModel value)
        {
            value = (InformativoViewModel)ValidarToken(value);
            if (value.mensagem.Code != 0)
            {
                return(value);
            }

            value.uri = this.ControllerContext.Controller.GetType().Name.Replace("Controller", "") + "/" + this.ControllerContext.RouteData.Values["action"].ToString();
            FacadeLocalhost <InformativoViewModel, InformativoModel, ApplicationContext> facade = new FacadeLocalhost <InformativoViewModel, InformativoModel, ApplicationContext>();

            return(facade.Save(value, Crud.EXCLUIR));
        }