Esempio n. 1
0
        public ActionResult Index(int?id)
        {
            var model = Session["Filtro"] as BancoViewModel;

            if (model == null)
            {
                model = new BancoViewModel();
                model.Filtro.PaginationParameters.PageSize         = this.DefaultPageSize;
                model.Filtro.PaginationParameters.UniqueIdentifier = GenerateUniqueIdentifier();
                model.Filtro.PaginationParameters.OrderBy          = "descricao";
            }

            model.PodeSalvar         = bancoAppService.EhPermitidoSalvar();
            model.PodeDeletar        = bancoAppService.EhPermitidoDeletar();
            model.PodeImprimir       = bancoAppService.EhPermitidoImprimir();
            model.PodeAcessarAgencia = bancoAppService.EhPermitidoAcessarAgencia();

            var banco = bancoAppService.ObterPeloId(id) ?? new BancoDTO();;

            if (id.HasValue && !banco.Id.HasValue)
            {
                messageQueue.Add(Application.Resource.Sigim.ErrorMessages.NenhumRegistroEncontrado, TypeMessage.Error);
            }

            model.Banco = banco;

            return(View(model));
        }