public ActionResult Index() { using (var ctx = new TPGPContext()) { ctx.Roles.Count(); } if (Session["username"] != null) { return(View("_AlreadyLoggedIn")); } return(View()); }
private void GetUserRolePermissions() { using (TPGPContext ctx = new TPGPContext()) { var user = ctx.Users.Where(u => u.Username == Username).FirstOrDefault(); if (user != null) { user.Role.Permissions = ctx.Roles.Where(r => r.Id == user.RoleId).SelectMany(r => r.Permissions).ToList(); Id = user.Id; Role = new UserRole { Id = user.Role.Id, RoleName = user.Role.RoleName }; user.Role.Permissions.ToList().ForEach(p => Role.Permissions.Add(new RolePermission { Id = p.Id, PermissionName = p.Name })); IsAdmin = user.Role.IsAdmin; } } }
public Repository(TPGPContext ctx) { dbContext = ctx; dbSet = dbContext.Set <T>(); }
public ScopeRepository(TPGPContext ctx) : base(ctx) { }
public ContractRepository(TPGPContext ctx) : base(ctx) { }
public UserRepository(TPGPContext ctx) : base(ctx) { }
public RoleRepository(TPGPContext ctx) : base(ctx) { }
public PermissionRepository(TPGPContext ctx) : base(ctx) { }
public PortfolioRepository(TPGPContext ctx) : base(ctx) { }
public GeographicalZoneRepository(TPGPContext ctx) : base(ctx) { }