Example #1
0
 public APIJsonResult SuccessList <TTarget, TSource>(string messsge, List <TSource> data, int?totalCount) where TTarget : new()
 {
     return(Success(messsge, new
     {
         List = UtilHelper.ConvertObjList <TSource, TTarget>(data),
         TotalCount = totalCount
     }));
 }
Example #2
0
        // GET api/values/5
        public APIJsonResult GetList(int pageSize, int pageIndex, string keywords)
        {
            int totalCount    = 0;
            var roleList      = new TRoleBLL().PagerQuery(pageSize, pageIndex, out totalCount, c => c.Name.Contains(keywords), c => c.CreateDate, true);
            var roleModelList = UtilHelper.ConvertObjList <TRole, RoleModel>(roleList);

            for (var i = 0; i < roleModelList.Count; i++)
            {
                var roleModel = roleModelList[i];
                var role      = roleList[i];
                roleModel.UserCount = role.TAdminUserRole.Count;
            }

            return(SuccessList("", roleModelList, totalCount));
        }
Example #3
0
        // GET api/values/5
        public APIJsonResult GetList(int pageSize, int pageIndex, string keywords)
        {
            int totalCount      = 0;
            var noticeList      = new TNoticeBLL().PagerQuery(pageSize, pageIndex, out totalCount, c => c.Title.Contains(keywords) || c.Content.Contains(keywords), c => c.CreateDate, false);
            var noticeModelList = UtilHelper.ConvertObjList <TNotice, NoticeModel>(noticeList);

            return(Success("", new
            {
                List = noticeModelList.Select(c => {
                    c.Content = "";
                    return c;
                }).ToList(),
                TotalCount = totalCount
            }));
        }
        // GET api/values/5
        public APIJsonResult GetList(int pageSize, int pageIndex, string keywords)
        {
            int totalCount    = 0;
            var adminUserList = new TAdminUserBLL().PagerQuery(pageSize, pageIndex, out totalCount, c => c.Account.Contains(keywords), c => c.CreateDate, false);

            var adminUserModelList = UtilHelper.ConvertObjList <TAdminUser, AdminUserModel>(adminUserList);

            for (int i = 0; i < adminUserModelList.Count; i++)
            {
                var adminUserModel = adminUserModelList[i];
                var adminUser      = adminUserList[i];
                adminUserModel.Role = UtilHelper.CopyProperties <RoleModel>(adminUser.TAdminUserRole.First().TRole);
            }


            return(Success("", new
            {
                List = adminUserModelList,
                TotalCount = totalCount
            }));
        }
        // GET api/values/5
        public APIJsonResult GetModuleList()
        {
            var loginUser = LoginManager.GetLoginUser();

            if (loginUser == null)
            {
                return(Failed("No module found."));
            }
            var permissions = new TRoleBLL().GetPermissions(loginUser.RoleID);

            var moduleBLL = new TModuleBLL();
            var modules   = moduleBLL.GetUserModules(permissions);

            var moduleModels = UtilHelper.ConvertObjList <TModule, ModuleModel>(modules);

            UtilHelper.ConvertChildObjList <TModule, ModuleModel, TModule, ModuleModel>(modules, moduleModels, "TModule1", "ChildModules");

            return(Success("", new
            {
                Modules = moduleModels
            }));
        }