Beispiel #1
0
        public void Execute()
        {
            try
            {
                Console.WriteLine("Give id of the student - integer: ");
                var stId = int.Parse(Console.ReadLine());
                Console.WriteLine("Give id of the homework - string: ");
                var hwId = Console.ReadLine();
                Console.WriteLine("Give grade value - double: ");
                var grade = double.Parse(Console.ReadLine());
                Console.WriteLine("Give the name of the professor - string: ");
                var prof = Console.ReadLine();
                Console.WriteLine("Give feedback for the given grade - string:  ");
                var feedBack = Console.ReadLine();

                var retValue = _srv.AddGrade(stId, hwId, grade, prof, feedBack);

                Console.WriteLine(retValue == null
                                        ? "The grade was added successfully!\n"
                                        : "The grade is already in the repository!\n");
            }
            catch (ValidatorException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (FormatException e)
            {
                Console.WriteLine("\n" + e.Message + "\n");
            }
            catch (StudentOrHomeworNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public async Task AddGrade()
        {
            AddGrade @Grade = new()
            {
                ImageUri = "URL/Grade_4_500px.png",
                Name     = "Grade 4"
            };

            await GradeService.AddGrade(@Grade);

            Assert.Pass();
        }
 public void AddGrade(Grade grade)
 {
     Debug.WriteLine("Dodawanie oceny");
     gradeService.AddGrade(grade);
 }