Beispiel #1
0
 /// <summary>
 /// Проверить, существует ли пользователь
 /// </summary>
 /// <param name="email">Email пользователя</param>
 /// <returns></returns>
 public static Users getUser(string email)
 {
     using (var db = new HackRussiaTestDBEntities())
     {
         return(db.Users.Where(t => t.email == email).FirstOrDefault());
     }
 }
Beispiel #2
0
        public static bool updateUser(int userId, Users user)
        {
            using (var db = new HackRussiaTestDBEntities())
            {
                var usr = db.Users.Single(u => u.Id == userId);

                usr    = user;
                usr.Id = userId;

                db.SaveChanges();

                return(true);
            }
        }
Beispiel #3
0
        public static bool insertUser(string email, string authToken, int voiceModels, string textpassword = "")
        {
            using (var db = new HackRussiaTestDBEntities())
            {
                db.Users.Add(new Users()
                {
                    email        = email,
                    OAuth        = authToken,
                    VoiceModels  = voiceModels,
                    textPassword = textpassword
                });

                db.SaveChanges();
            }

            return(true);
        }