Beispiel #1
0
 static public bool EditAward(string Id, string Title, string Image)
 {
     if (CheckGuid(Id, out Guid id))
     {
         if (!CheckTitleAward(Title))
         {
             Title = usersandawardsLogic.GetAward(id).Title;
         }
         if (Image.Length != 0)
         {
             if (!CheckImageAward(Image))
             {
                 Image = Path + @"Pages\Image\default.png";
             }
             usersandawardsLogic.EditAward(id, Title, ImageToByte(Image), true);
             return(true);
         }
         else
         {
             Image = Path + @"Pages\Image\default.png";
             usersandawardsLogic.EditAward(id, Title, ImageToByte(Image), false);
             return(true);
         }
     }
     return(false);
 }
Beispiel #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");
            }
        }