Пример #1
0
        public void ParsAudsPrepods()
        {
            ParaName paraName1 = new ParaName() { Name = "Matematika" };
            ParaName paraName2 = new ParaName() { Name = "Programming" };
            ParaName paraName3 = new ParaName() { Name = "Fizika" };

            ctx.ParaNames.Add(paraName1);
            ctx.ParaNames.Add(paraName2);
            ctx.ParaNames.Add(paraName3);

            ctx.Pars.Add(new Para() { ParaName = paraName1, Position = 1 });
            ctx.Pars.Add(new Para() { ParaName = paraName2, Position = 2 });
            ctx.Pars.Add(new Para() { ParaName = paraName3, Position = 3 });

            ctx.Auds.Add(new Aud() { Name = "A301" });
            ctx.Auds.Add(new Aud() { Name = "A302" });
            ctx.Auds.Add(new Aud() { Name = "A303" });

            FirstName firstName = new FirstName() { Name = "MegaPrepod" };
            ctx.FirstNames.Add(firstName);

            ctx.Prepods.Add(new Prepod() { FirstName = firstName });
            ctx.Prepods.Add(new Prepod() { FirstName = firstName });
            ctx.Prepods.Add(new Prepod() { FirstName = firstName });


            ctx.SaveChanges();
        }
Пример #2
0
        public IActionResult mockWeek([FromRoute] int id)
        {
            //            new FakeDataMaker(_context).ParsAudsPrepods();
            List<Para> listPara = new List<Para>();
            List<TimeField> listTimeField = new List<TimeField>();
            Dictionary<int, TimeSet> mapDayToTimeSet = new Dictionary<int, TimeSet>();

            listTimeField.Add(new TimeField() { TimeFieldId = 1, begin =  8 * 60 +  0, end =  9 * 60 + 20, TimeSetId = 1 });
            listTimeField.Add(new TimeField() { TimeFieldId = 2, begin =  9 * 60 + 35, end = 10 * 60 + 55, TimeSetId = 1 });
            listTimeField.Add(new TimeField() { TimeFieldId = 3, begin = 11 * 60 + 10, end = 12 * 60 + 30, TimeSetId = 1 });
            listTimeField.Add(new TimeField() { TimeFieldId = 4, begin = 12 * 60 + 50, end = 14 * 60 + 10, TimeSetId = 1 });
            listTimeField.Add(new TimeField() { TimeFieldId = 5, begin = 14 * 60 + 20, end = 15 * 60 + 40, TimeSetId = 1 });
            listTimeField.Add(new TimeField() { TimeFieldId = 6, begin = 15 * 60 + 50, end = 17 * 60 + 10, TimeSetId = 1 });
            listTimeField.Add(new TimeField() { TimeFieldId = 7, begin = 17 * 60 + 20, end = 18 * 60 + 40, TimeSetId = 1 });

            TimeSet timeSet = new TimeSet() { TimeSetId = 1, Name = "Летнее" };
            //TimeSet timeSetWinter = new TimeSet() { TimeSetId = 2, Name = "Зимнее" };
            mapDayToTimeSet.Add(1, timeSet);
            mapDayToTimeSet.Add(2, timeSet);
            mapDayToTimeSet.Add(3, timeSet);
            mapDayToTimeSet.Add(4, timeSet);
            mapDayToTimeSet.Add(5, timeSet);
            mapDayToTimeSet.Add(6, timeSet);
            mapDayToTimeSet.Add(7, timeSet);

            Week week = new Week() { WeekId = 1, dateMonday = System.DateTime.Now.Date };

            Faculty faculty = new Faculty() { FacultyId = id, Name = "ФКЕТ" };
            Course course = new Course() { CourseId = 1, Name = "4", FacultyId = faculty.FacultyId };
            Group group = new Group() { GroupId = 1, Name = "401-В", CourseId = course.CourseId };

            for (int fakeID = 1; fakeID <= 7; fakeID++)
            {
                Prepod prepod = new Prepod()
                {
                    PrepodId = fakeID,
                    Birthday = System.DateTime.Now.Date,
                    FirstName = new FirstName (){ FirstNameId = 1, Name = "Вася"+ fakeID },
                    LastName = new LastName() { LastNameId = 1, Name = "Василенко" + fakeID },
                    MidName = new MidName() { MidNameId = 1, Name = "Васильевич"+ fakeID }
                };
                ParaName paraName = new ParaName() { ParaNameId = 1, Name = "Структуры данных" + fakeID };
                Aud aud = new Aud() { AudId = 1, Name = "A30" + fakeID };

                listPara.Add(new Para()
                {
                    ParaId = fakeID,
                    Position = fakeID,
                    WeekDay = 1,
                    ParaName = paraName,
                    Prepod = prepod,
                    Aud = aud,
                    GroupId = group.GroupId,
                    WeekId = week.WeekId
                });
            }

            group.Pars = listPara;
            course.Groups = new List<Group>() { group };
            faculty.Courses = new List<Course>() { course };

            return Ok(new
            {
                //faculty
                faculty = faculty,
                //Time
                mapDayToTimeSet = mapDayToTimeSet,
                listTimeField = listTimeField               
            });
        }