Example #1
0
        private static void AddAwardToUser()
        {
            Console.Write("Enter ID of user: "******"Id of user must be a number");
            }

            if (awardLogic.GetMaxId() == 0)
            {
                Console.WriteLine("Not a single award has been created yet");
                return;
            }

            Console.WriteLine();
            ShowAwards();

            Console.WriteLine();
            Console.WriteLine("Pick one of the Id`s: ");
            if (!int.TryParse(Console.ReadLine(), out awardId))
            {
                throw new ArgumentException("Id of award must be a number");
            }

            userLogic.AddAwardToUser(userId, awardId);
        }
Example #2
0
        private static void AddAwardToUser()
        {
            Console.Write("Enter users ID: ");
            int  userID;
            int  awardID;
            bool userParse = Int32.TryParse(Console.ReadLine(), out userID);

            if (!userParse)
            {
                throw new ArgumentException("Users ID must be a number!");
            }
            if (awardLogic.GetMaxId() > 0)
            {
                ShowAwards();
                Console.Write("Choose one ID from awards list: ");
                bool awardParse = Int32.TryParse(Console.ReadLine(), out awardID);
                if (!awardParse)
                {
                    throw new ArgumentException("Awards ID must be a number!");
                }
            }
            else
            {
                Console.WriteLine("Nope any awards.");
                Console.Write("Press any button to continue...");
                Console.ReadLine();
                return;
            }
            userLogic.AddAwardToUser(userID, awardID);
            Console.Write("Press any button to continue...");
            Console.ReadLine();
        }
Example #3
0
        public bool AddAwardToUser(int userId, int awardId)
        {
            if (!userBll.UserHasAward(userId, awardId))
            {
                return(userBll.AddAwardToUser(userId, awardId));
            }

            return(false);
        }
Example #4
0
 public bool AddAwardToUser(int userId, int awardId)
 {
     return(userBll.AddAwardToUser(userId, awardId));
 }