public Task <IList <string> > GetRolesAsync(ApplicationUser user) { if (user != null) { return(Task.Factory.StartNew(() => { IList <string> roles = AccountRoleController.GetUserRoles(user.Id); return roles; })); } else { throw new ArgumentNullException("user"); } }
public Task <bool> IsInRoleAsync(ApplicationUser user, string roleName) { if (user != null) { return(Task.Factory.StartNew(() => { IList <string> roles = AccountRoleController.GetUserRoles(user.Id); foreach (string role in roles) { if (role.ToUpper() == roleName.ToUpper()) { return true; } } return false; })); } else { throw new ArgumentNullException("user"); } }