Example #1
0
        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);
            }
        }
Example #2
0
 public ContactUsController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
 public SecurityController(SmartEducationContext context, IConfiguration configuration)
 {
     this.db       = context;
     help          = new Helper();
     Configuration = configuration;
 }
 public StudentsController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
 public PermissionController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
 public AcadimacYearsController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }
 public MessagesController(SmartEducationContext context)
 {
     this.db = context;
     help    = new Helper();
 }