コード例 #1
0
 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;
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 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();
     }
 }