/// <summary>
 /// Deprecated Method for adding a new object to the UserGames EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserGames(UserGame userGame)
 {
     base.AddObject("UserGames", userGame);
 }
 /// <summary>
 /// Create a new UserGame object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="hangman">Initial value of the Hangman property.</param>
 /// <param name="blocks">Initial value of the Blocks property.</param>
 public static UserGame CreateUserGame(global::System.Int32 id, global::System.Int32 userId, global::System.Int32 hangman, global::System.Int32 blocks)
 {
     UserGame userGame = new UserGame();
     userGame.Id = id;
     userGame.UserId = userId;
     userGame.Hangman = hangman;
     userGame.Blocks = blocks;
     return userGame;
 }
        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;
        }