/// <summary>
 /// Deprecated Method for adding a new object to the UserCups EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserCups(UserCup userCup)
 {
     base.AddObject("UserCups", userCup);
 }
 /// <summary>
 /// Create a new UserCup object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="addCup">Initial value of the AddCup property.</param>
 /// <param name="diffCup">Initial value of the DiffCup property.</param>
 /// <param name="divCup">Initial value of the DivCup property.</param>
 /// <param name="mulCup">Initial value of the MulCup property.</param>
 public static UserCup CreateUserCup(global::System.Int32 id, global::System.Int32 userId, global::System.Int32 addCup, global::System.Int32 diffCup, global::System.Int32 divCup, global::System.Int32 mulCup)
 {
     UserCup userCup = new UserCup();
     userCup.Id = id;
     userCup.UserId = userId;
     userCup.AddCup = addCup;
     userCup.DiffCup = diffCup;
     userCup.DivCup = divCup;
     userCup.MulCup = mulCup;
     return userCup;
 }
        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;
        }