public override bool IsUserInRole(string username, string roleName) { if (roleName == Roles.admin.ToString()) { using (OnlineVideosDataContext dc = new OnlineVideosDataContext()) { if (!dc.DatabaseExists()) { dc.CreateDatabase(); dc.SubmitChanges(); } return dc.User.Any(u => u.Email == username && u.IsAdmin); } } return false; }
public override bool ValidateUser(string username, string password) { using (OnlineVideosDataContext dc = new OnlineVideosDataContext()) { if (!dc.DatabaseExists()) { dc.CreateDatabase(); dc.SubmitChanges(); } var result = dc.User.Any(u => u.Email == username && u.Password == password); return result; } }
public override string GetPassword(string username, string answer) { using (OnlineVideosDataContext dc = new OnlineVideosDataContext()) { if (!dc.DatabaseExists()) { dc.CreateDatabase(); dc.SubmitChanges(); } return (from u in dc.User where u.Email == username select u.Password).First(); } }