예제 #1
0
        private void RewardUser()
        {
            Console.WriteLine($"{Environment.NewLine}Enter user ID to reward:");
            User user = ReadUserIfExist();

            if (user != null)
            {
                Console.WriteLine($"{Environment.NewLine}Set ID of awards separated by a space to reward user:"******"s" : "";

                    Console.Write($"{Environment.NewLine}Award{pluralChar} ");

                    foreach (var award in awards)
                    {
                        award.UsersId.Add(user.Id);

                        _awardLogic.UpdateAward(award);

                        Console.Write($"\"{award.Title}\" ");
                    }
                    Console.Write($"assigned to user {user.Name}.{Environment.NewLine}");
                }
            }
        }
예제 #2
0
        private static void UpdateAward(IAwardLogic awardLogic, string Title, int Id)
        {
            Award award = new Award()
            {
                Id    = Id,
                Title = Title,
            };

            awardLogic.UpdateAward(award);
        }
예제 #3
0
        public bool UpdateAward(EditAwardVM award, HttpRequestBase request)
        {
            var updatedAward = Mapper.Map <AwardDTO>(award);
            var uploaded     = request.Files["Uploaded"];

            if (uploaded != null && uploaded.ContentLength != 0)
            {
                byte[] bytes = new byte[uploaded.ContentLength];
                uploaded.InputStream.Read(bytes, 0, uploaded.ContentLength);

                var img = new ImageDTO()
                {
                    OwnerId = updatedAward.ImageId,
                    Data    = bytes,
                    Type    = uploaded.ContentType
                };

                pictureBll.UpdateImage(img);
            }

            return(awardBll.UpdateAward(updatedAward));
        }
예제 #4
0
        //дейтсвия для Awards
        private static void AwardsAction()
        {
            while (true)
            {
                Console.WriteLine();
                Console.WriteLine($"1: Find award by ID");
                Console.WriteLine($"2: Find award by Name");
                Console.WriteLine($"3: Find award by the first letter");
                Console.WriteLine($"4: Find award whose name includes the entered word");
                Console.WriteLine($"5: Delete award");
                Console.WriteLine($"6: Edit award");
                Console.WriteLine($"7: EXIT");

                Console.Write("Choose action: ");

                var userEnter = Console.ReadLine();

                switch (userEnter)
                {
                case "1":
                    Console.Write($"Award's ID: ");
                    var id_1     = Console.ReadLine();
                    var result_1 = awardLogic.GetAwardById(id_1);
                    Console.WriteLine($"{result_1.IdAward} : {result_1.Title} : {result_1.Description}{Environment.NewLine}");
                    break;

                case "2":
                    Console.Write($"Award's Title: ");
                    var name_2 = Console.ReadLine();
                    foreach (var item in awardLogic.GetAwardByTitle(name_2))
                    {
                        Console.WriteLine($"{item.IdAward} : {item.Title} : {item.Description}{Environment.NewLine}");
                    }
                    break;

                case "3":
                    Console.Write($"Write letter: ");
                    var letter_3 = Console.ReadLine();
                    foreach (var item in awardLogic.GetAwardByLetter(letter_3))
                    {
                        Console.WriteLine($"{item.IdAward} : {item.Title} : {item.Description}{Environment.NewLine}");
                    }
                    break;

                case "4":
                    Console.Write($"Write word: ");
                    var word = Console.ReadLine();
                    foreach (var item in awardLogic.GetAwardByWord(word))
                    {
                        Console.WriteLine($"{item.IdAward} : {item.Title} : {item.Description}{Environment.NewLine}");
                    }
                    break;

                case "5":
                    Console.Write($"Award's ID: ");
                    var id_5 = Console.ReadLine();
                    awardLogic.DeleteAward(id_5);
                    break;

                case "6":
                    Console.Write($"award's ID: ");
                    var id_6     = Console.ReadLine();
                    var result_6 = awardLogic.GetAwardById(id_6);
                    Console.Write($"award's Titile: ");
                    var title = Console.ReadLine();
                    Console.Write($"award's Description: ");
                    var description = Console.ReadLine();
                    awardLogic.UpdateAward(id_6, title, description);
                    break;

                case "7":
                    return;

                default:
                    break;
                }
            }
        }
예제 #5
0
 public bool UpdateAward(AwardDTO award)
 {
     return(awardBll.UpdateAward(award));
 }