/// <summary>
 /// Create a new UserSmallMedal object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="goldMedals">Initial value of the GoldMedals property.</param>
 /// <param name="silverMedals">Initial value of the SilverMedals property.</param>
 /// <param name="bronzeMedals">Initial value of the BronzeMedals property.</param>
 public static UserSmallMedal CreateUserSmallMedal(global::System.Int32 id, global::System.Int32 userId, global::System.Int32 goldMedals, global::System.Int32 silverMedals, global::System.Int32 bronzeMedals)
 {
     UserSmallMedal userSmallMedal = new UserSmallMedal();
     userSmallMedal.Id = id;
     userSmallMedal.UserId = userId;
     userSmallMedal.GoldMedals = goldMedals;
     userSmallMedal.SilverMedals = silverMedals;
     userSmallMedal.BronzeMedals = bronzeMedals;
     return userSmallMedal;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the UserSmallMedals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserSmallMedals(UserSmallMedal userSmallMedal)
 {
     base.AddObject("UserSmallMedals", userSmallMedal);
 }
        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;
        }