Exemplo n.º 1
0
        private IEnumerable<Mark> GenerateMarks(int marksCount)
        {
            List<Mark> marks = new List<Mark>();

            for (int i = 1; i <= marksCount; i++)
            {
                Mark mark = new Mark()
                {
                    Score = random.Next(2, 6) + Math.Round(random.NextDouble(), 2), //GetRandomBetween(2, 6),
                    Subject = "Subject#" + i,
                };
                marks.Add(mark);
            }

            return marks;
        }
Exemplo n.º 2
0
        private List<Student> GenerateStudents(int num)
        {
            List<Student> students = new List<Student>();
            Random rand = new Random();
            for (int i = 0; i < num; i++)
            {
                Student currStudent = new Student();
                currStudent.Id = i + 1;
                currStudent.Grade = rand.Next(1, 13);
                currStudent.Name = "Student#" + i;

                for (int k = 0; k < i; k++)
                {
                    Mark currMark = new Mark();
                    currMark.Subject = "Subject#" + k;
                    currMark.Score = rand.Next(2, 7);
                    currStudent.Marks.Add(currMark);
                }

                students.Add(currStudent);
            }

            return students;
        }