public override void CreateRole(string roleName) { var newRole = new ORM.Roles() { Name = roleName }; using (var context = new AlbumDbEntities()) { context.Roles.Add(newRole); context.SaveChanges(); } }
public override bool IsUserInRole(string email, string roleName) { Users user = UserRepositoryEntity.GetAll().FirstOrDefault(u => u.Email == email); if (user == null) { return(false); } ORM.Roles userRole = RoleRepositoryEntity.Get(user.RoleId); if (userRole != null && userRole.Name == roleName) { return(true); } return(false); }