コード例 #1
0
ファイル: Program.cs プロジェクト: quela/myprojects
        public static void Main()
        {
            // Used in development process.
            var school = new School() { Name = "Telerik Academy", Location = "Sofia" };

            var firstMark = new Mark() { Subject = "math", Value = 5.00 };
            var secondMark = new Mark() { Subject = "math", Value = 6.00 };
            var thirdMark = new Mark() { Subject = "math", Value = 4.00 };
            var fourthMark = new Mark() { Subject = "c#", Value = 6.00 };
            var fifthMark = new Mark() { Subject = "js", Value = 5.00 };
            var sixthMark = new Mark() { Subject = "css", Value = 4.00 };

            var firstStudent = new Student()
            {
                FirstName = "Nikolay",
                LastName = "Kostov",
                Age = 21,
                School = school,
                Grade = 12,
                Marks = new List<Mark>() { secondMark, fourthMark }
            };

            var secondStudent = new Student()
            {
                FirstName = "Doncho",
                LastName = "Minkov",
                Age = 24,
                School = school,
                Grade = 11,
                Marks = new List<Mark>() { firstMark, fifthMark }
            };

            var thirdStudent = new Student()
            {
                FirstName = "Georgi",
                LastName = "Georgiev",
                Age = 25,
                School = school,
                Grade = 10,
                Marks = new List<Mark>() { thirdMark, sixthMark }
            };

            //AddStudent(thirdStudent);
            //AddSchool(school);

            //var students = Client.GetAsync("api/students?subject=math&value=5.00").Result.Content.ReadAsAsync<IEnumerable<Student>>().Result;

            //foreach (var student in students)
            //{
            //    Console.WriteLine(student.FirstName);
            //}
        }
コード例 #2
0
        private static Student MakeSimpleStudent(string firstName, string lastName, double mathValue)
        {
            var school = new School() { Name = "Telerik Academy", Location = "Sofia" };

            var firstMark = new Mark() { Subject = "math", Value = mathValue };
            var secondMark = new Mark() { Subject = "c#", Value = 6.00 };
            var thirdMark = new Mark() { Subject = "js", Value = 5.00 };
            var fourthMark = new Mark() { Subject = "css", Value = 4.00 };

            var student = new Student()
            {
                FirstName = firstName,
                LastName = lastName,
                Age = 21,
                School = school,
                Grade = 12,
                Marks = new List<Mark>() { firstMark, secondMark, thirdMark, fourthMark }
            };

            return student;
        }