コード例 #1
0
ファイル: Helper.cs プロジェクト: AhmedTareck/smart-eductaion
        public bool getPermissin(string perimm, long userId, SmartEducationContext db)
        {
            try
            {
                if (userId <= 0)
                {
                    return(false);
                }
                var cUser = (from p in db.Users
                             where p.Id == userId
                             select p).SingleOrDefault();
                if (cUser.UserType == 1)
                {
                    return(true);
                }
                var pre = (from p in db.Permissions
                           join g in db.PermissionGroup on p.Id equals g.PermissioinId
                           where (g.GroupId == cUser.GroupId)
                           select p.Name).ToList();

                var t = pre.Contains(perimm);
                return(t);
                // string dogCsv = string.Join(",", pre.ToArray());
            }
            catch (Exception e)
            {
                return(false);
            }
        }
コード例 #2
0
 public ContactUsController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
コード例 #3
0
 public SecurityController(SmartEducationContext context, IConfiguration configuration)
 {
     this.db       = context;
     help          = new Helper();
     Configuration = configuration;
 }
コード例 #4
0
 public StudentsController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
コード例 #5
0
 public PermissionController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
コード例 #6
0
 public AcadimacYearsController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
コード例 #7
0
 public MessagesController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }