public override bool IsUserInRole(string username, string roleName) { SeniorDBEntities db = new SeniorDBEntities(); var user = db.Users.Where(a => a.username.ToLower() == username.ToLower()).FirstOrDefault(); if (user == null) { return(false); } return(user.Role.Name.ToLower() == roleName.ToLower()); }
public override string[] GetRolesForUser(string username) { string[] roles = { Constants.ROLES.GUEST }; SeniorDBEntities db = new SeniorDBEntities(); var user = db.Users.Where(a => a.username.ToLower() == username.ToLower()).FirstOrDefault(); if (user != null) { return new string[] { user.Role.Name } } ; return(roles); }