示例#1
0
 public static bool AddAwardToUser(string SUserID, string SAwardID)
 {
     if (CheckGuid(SUserID, out Guid UserId))
     {
         while (true)
         {
             if (usersandawardsLogic.GetUser(UserId) != null)
             {
                 break;
             }
             else
             {
                 return(false);
             }
         }
         ;
     }
     else
     {
         return(false);
     }
     if (CheckGuid(SAwardID, out Guid AwardId))
     {
         while (true)
         {
             if (usersandawardsLogic.GetAward(AwardId) != null)
             {
                 break;
             }
             else
             {
                 return(false);
             }
         }
         ;
     }
     else
     {
         return(false);
     }
     if (usersandawardsLogic.AddAwardToUser(UserId, AwardId))
     {
         return(true);
     }
     return(false);
 }
示例#2
0
        public static void AddAwardToUser()
        {
            Console.Clear();
            ViewUsers(usersandawardsLogic.GetAllUsers(), false);
            ViewAwards(usersandawardsLogic.GetAllAwards(), false);
            Guid UserId;
            Guid AwardId;

            Console.WriteLine("Enter ID of user:"******"User with this ID don't found. Please try again");
                }
            }
            ;
            Console.WriteLine("Enter ID of award:");
            while (true)
            {
                AwardId = EnterGuid();
                if (usersandawardsLogic.GetAward(AwardId) != null)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Award with this ID don't found. Please try again");
                }
            }
            ;
            if (usersandawardsLogic.AddAwardToUser(UserId, AwardId))
            {
                Console.WriteLine("Add award is successfull");
            }
            else
            {
                Console.WriteLine("Add award is failed");
            }
        }