Inheritance: System.Data.Linq.DataContext
Beispiel #1
0
 /// <summary>
 /// Gets the user.
 /// </summary>
 /// <param name="email">The email.</param>
 /// <returns></returns>
 public static UserProfile GetUser(string email)
 {
     UserProfile profile = null;
     using (ExamSystemDataContext db = new ExamSystemDataContext())
     {
         profile = (from p in db.UserProfiles
                    where p.EmailAddress == email
                     select p).FirstOrDefault();
     }
     return profile;
 }
Beispiel #2
0
 public static List<UserProfile> GetUsers(string searchString)
 {
     List<UserProfile> profiles = null;
     using (ExamSystemDataContext db = new ExamSystemDataContext())
     {
         if (string.IsNullOrEmpty(searchString))
         {
             profiles = (from p in db.UserProfiles
                         select p).ToList();
         }
         else
         {
             profiles = (from p in db.UserProfiles
                         where SqlMethods.Like(p.EmailAddress, searchString)
                         select p).ToList();
         }
     }
     return profiles;
 }
Beispiel #3
0
        public static UserProfile Save(UserProfile profile)
        {
            if (profile.UserId == 0)
            {
                //save the user.
                using (ExamSystemDataContext db = new ExamSystemDataContext())
                {
                    db.UserProfiles.InsertOnSubmit(profile);
                    db.SubmitChanges();
                }

            }
            else
            {
                //update user
            }
            return null;
        }