Пример #1
0
        public async Task <ActionResult <IEnumerable <RequisicaoTableViewModel> > > getsRequisicoes([FromBody] DataTablesResponseViewModel model)
        {
            string filtro          = model.Search.Value;
            int    ordernar        = model.Order[0].Column;
            string ordernarDirecao = model.Order[0].Dir;

            int            _draw           = model.Draw;
            int            startRec        = model.Start;
            int            pageSize        = model.Length;
            IsolationLevel _isolationLevel = IsolationLevel.ReadUncommitted;
            ISqlBase       sqlBase         = SqlServerFactory.Create();
            FuncaoManager  funcaoManager   = FuncaoManager.Create(sqlBase, _isolationLevel);

            List <IdentityRoleClaim <string> > funcoesRequisicoes = await funcaoManager.getsRequisicoes(model.empresaUsuarioFuncao.FuncaoId, startRec, filtro, pageSize);

            IList <RequisicaoTableViewModel> tableFuncaoRequisicao = funcoesRequisicoes.ConvertAll(new Converter <IdentityRoleClaim <string>, RequisicaoTableViewModel>(FuncaoConverter.converterIdentityRoleClaimParaClaim));

            IList <RequisicaoTableViewModel> funcoesRequisicoesOrdenadas = FuncaoConfiguracao.ordenacaoTableFuncoesRequisicoes(ordernar, ordernarDirecao, tableFuncaoRequisicao);

            int totalRegistros = funcaoManager.totalRegistro;

            var retorno = this.Json(new { draw = _draw, recordsTotal = totalRegistros, recordsFiltered = totalRegistros, data = funcoesRequisicoesOrdenadas });

            return(retorno);
        }
Пример #2
0
        public async Task <ActionResult <IEnumerable <IdentityRole> > > Gets([FromBody] DataTablesResponseViewModel model)
        {
            string filtro          = model.Search.Value;
            int    ordernar        = model.Order[0].Column;
            string ordernarDirecao = model.Order[0].Dir;

            int _draw    = model.Draw;
            int startRec = model.Start;
            int pageSize = model.Length;

            FuncaoManager funcaoManager = FuncaoManager.Create(_roleManager);

            IList <IdentityRole> funcoes = await funcaoManager.Gets(startRec, filtro, pageSize);

            //IList<EmpresaTableViewModel> tablesEempresa = converterEmpresaViewModelParaEmpresaTableViewModel(empresas);
            List <IdentityRole> funcoesOrdenadas = FuncaoConfiguracao.ordenacaoTableFuncoes(ordernar, ordernarDirecao, funcoes);

            int totalRegistros = funcaoManager.totalRegistro;

            var retorno = this.Json(new { draw = _draw, recordsTotal = totalRegistros, recordsFiltered = totalRegistros, data = funcoesOrdenadas });

            return(retorno);
        }