/// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static User CreateUser(global::System.Int32 id)
 {
     User user = new User();
     user.Id = id;
     return user;
 }
        public bool Register(string username, string password, bool isTeacher, string teacherName)
        {
            var user = BusinessStructure.Instance.Model.Users.FirstOrDefault(item => item.Username.Equals(username));
            if (user != null)
            {
                return false;
            }

            User newUser = new User();
            newUser.Username = username;
            newUser.Password = password;
            newUser.IsTeacher = isTeacher;
            if (!isTeacher)
            {
                User teacher = BusinessStructure.Instance.Model.Users.First(item => item.Username.Equals(teacherName));
                newUser.TeacherId = teacher.Id;
            }
            BusinessStructure.Instance.Model.Users.AddObject(newUser);

            UserScore userScore = new UserScore();
            userScore.Score = 0;
            userScore.User = newUser;
            BusinessStructure.Instance.Model.UserScores.AddObject(userScore);

            UserSmallMedal userSmallMedal = new UserSmallMedal();
            userSmallMedal.GoldMedals = 0;
            userSmallMedal.SilverMedals = 0;
            userSmallMedal.BronzeMedals = 0;
            userSmallMedal.User = newUser;
            BusinessStructure.Instance.Model.UserSmallMedals.AddObject(userSmallMedal);

            UserBigMedal userBigMedal = new UserBigMedal();
            userBigMedal.GoldMedals = 0;
            userBigMedal.SilverMedals = 0;
            userBigMedal.BronzeMedals = 0;
            userBigMedal.User = newUser;
            BusinessStructure.Instance.Model.UserBigMedals.AddObject(userBigMedal);

            UserCup userCup = new UserCup();
            userCup.AddCup = 0;
            userCup.DiffCup = 0;
            userCup.DivCup = 0;
            userCup.MulCup = 0;
            userScore.User = newUser;
            BusinessStructure.Instance.Model.UserCups.AddObject(userCup);

            UserGame userGame = new UserGame();
            userGame.Hangman = 0;
            userGame.Blocks = 0;
            userScore.User = newUser;
            BusinessStructure.Instance.Model.UserGames.AddObject(userGame);

            BusinessStructure.Instance.Model.SaveChanges();

            return true;
        }