Exemple #1
0
 public async Task <Models.ViewModels.Layui.TableViewModel <Application.Models.ViewModels.PermissionViewModel> > GetByPerentId(string pid)
 {
     return(await Task.Run(() =>
     {
         Models.ViewModels.Layui.TableViewModel <Application.Models.ViewModels.PermissionViewModel> res = new Models.ViewModels.Layui.TableViewModel <Application.Models.ViewModels.PermissionViewModel>();
         try
         {
             res.data = new List <Application.Models.ViewModels.PermissionViewModel>();
             res.data = RecursiveByParentId(pid);
             res.code = 0;
             res.count = res.data.Count;
             if (res.count < 1)
             {
                 res.code = -1;
                 res.msg = "没有数据!";
             }
         }
         catch (Exception ex)
         {
             res.code = -1;
             res.msg = "异常错误:" + ex;
         }
         return res;
     }));
 }
Exemple #2
0
 public async Task <Models.ViewModels.Layui.TableViewModel <Application.Models.ViewModels.RoleViewModel> > GetAll()
 {
     return(await Task.Run(() =>
     {
         Models.ViewModels.Layui.TableViewModel <Application.Models.ViewModels.RoleViewModel> models = new Models.ViewModels.Layui.TableViewModel <Application.Models.ViewModels.RoleViewModel>();
         models.data = new List <Models.ViewModels.RoleViewModel>();
         var roleList = DbRepository.QueryAll();
         roleList.ForEach(x =>
         {
             models.data.Add(new Models.ViewModels.RoleViewModel()
             {
                 RoleId = x.RoleId,
                 RoleName = x.RoleName,
                 RoleDescription = x.RoleDescription,
                 IsValid = x.IsValid
             });
         });
         models.code = 0;
         models.count = models.data.Count;
         if (models.count < 1)
         {
             models.code = -1;
             models.msg = "没有数据!";
         }
         return models;
     }));
 }