public async Task <IActionResult> RemoveStudentFromGroup([FromBody] StudentGroupDto studentGroup) { var student = await _studentManager.FindByIdAsync(studentGroup.StudentId); if (student == null) { return(NotFound("Student was not found")); } var group = await _groupManager.FindByNameAsync(studentGroup.GroupName); if (group == null) { return(NotFound("Group was not found")); } if (!_studentManager.IsInGroup(student, group)) { return(BadRequest("The student is not a member of this group")); } await _studentManager.RemoveFromGroupAsync(student, group); return(Ok()); }
public async Task <IActionResult> AddStudentToGroup([FromBody] StudentGroupDto studentGroup) { var student = await _studentManager.FindByIdAsync(studentGroup.StudentId); if (student == null) { return(NotFound("Student was not found")); } var group = await _groupManager.FindByNameAsync(studentGroup.GroupName); if (group == null) { return(NotFound("Group was not found")); } if (_studentManager.IsInGroup(student, group)) { return(BadRequest("Student already is in group")); } await _studentManager.AddToGroupAsync(student, group); return(Ok()); }
public async Task <StudentGroupDto> UpdateStudentGroupAsync(long id, StudentGroupDto updateDto, string accessToken) { var updateStudentGroupTask = _apiUtil.PutAsync($"{_config.Value.Urls.Api.Https}/api/student_groups/{id}", _mapper.Map <UpdateStudentGroupDto>(updateDto), accessToken); await updateStudentGroupTask; return(updateDto); }
public static void SeedStudentGroupsAdult(this CespContext context) { var groupAdult = context .GroupBunches .FirstOrDefault(grb => grb.Name == "Взрослые группы"); if (context.StudentGroups.Any( gr => gr.GroupBunchId == groupAdult.Id)) { return; } var timeGroupMorning = context .GroupTimes .FirstOrDefault(gt => gt.Name == "Утренний курс"); var timeGroupDay = context .GroupTimes .FirstOrDefault(gt => gt.Name == "Дневной курс"); var timeGroupEvening = context .GroupTimes .FirstOrDefault(gt => gt.Name == "Вечерний курс"); var timeGroupWeekend = context .GroupTimes .FirstOrDefault(gt => gt.Name == "Курс выходного дня"); // Испанский язык — Начальный уровень (A1) var levelA1 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A1"); var courseStandart = context.Courses.FirstOrDefault(c => c.Name == "Стандартный курс испанского"); var courseWeekend = context.Courses.FirstOrDefault(c => c.Name == "Курс выходного дня"); #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 29), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, пятница", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 2, 13), IsWorking = true, IsAvailable = false, LanguageLevelId = levelA1.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupMorning.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 2, 19), IsWorking = true, IsAvailable = false, LanguageLevelId = levelA1.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupDay.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(12, 15, 0), EndLessonTime = new TimeSpan(15, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 18), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 2, 16), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(12, 0, 0), EndLessonTime = new TimeSpan(16, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 3, 16), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(14, 30, 0), EndLessonTime = new TimeSpan(18, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion //Испанский язык — Базовый уровень (A2.1, А2.2) var levelA21 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A2.1"); var levelA22 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A2.2"); #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 4), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupDay.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(12, 00, 0), EndLessonTime = new TimeSpan(14, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 16), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupDay.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(12, 15, 0), EndLessonTime = new TimeSpan(15, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 4, 8), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupMorning.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 4, 17), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupMorning.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "среда, пятница", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 2, 12), IsWorking = true, IsAvailable = false, LanguageLevelId = levelA21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 21), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 21), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 4, 23), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 4, 14), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(10, 30, 0), EndLessonTime = new TimeSpan(14, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 4, 14), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(11, 0, 0), EndLessonTime = new TimeSpan(14, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion // Испанский язык — Продвинутый уровень (B1, B2) var levelB11 = context .LanguageLevels .FirstOrDefault(l => l.Name == "B1.1"); var levelB21 = context .LanguageLevels .FirstOrDefault(l => l.Name == "B2.1"); var levelB22 = context .LanguageLevels .FirstOrDefault(l => l.Name == "B2.2"); var levelB23 = context .LanguageLevels .FirstOrDefault(l => l.Name == "B2.3"); var levelC = context .LanguageLevels .FirstOrDefault(l => l.Name == "C1.1"); #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 2, 12), IsWorking = true, IsAvailable = false, LanguageLevelId = levelB11.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupMorning.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(11, 0, 0), EndLessonTime = new TimeSpan(13, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 4, 3), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB11.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 4, 13), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(10, 30, 0), EndLessonTime = new TimeSpan(14, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 4, 12), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupMorning.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(11, 0, 0), EndLessonTime = new TimeSpan(13, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 3, 25), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupEvening.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, Start = new DateTime(2019, 2, 26), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupMorning.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(9, 30, 0), EndLessonTime = new TimeSpan(12, 15, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 1, 19), IsWorking = true, IsAvailable = false, LanguageLevelId = levelB21.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(10, 30, 0), EndLessonTime = new TimeSpan(14, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 4, 20), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(10, 30, 0), EndLessonTime = new TimeSpan(14, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 3, 16), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB22.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 3, 16), IsWorking = true, IsAvailable = true, LanguageLevelId = levelB23.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, Start = new DateTime(2019, 4, 12), IsWorking = true, IsAvailable = true, LanguageLevelId = levelC.Id, GroupBunchId = groupAdult.Id, GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "пятница", StartLessonTime = new TimeSpan(19, 30, 0), EndLessonTime = new TimeSpan(21, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); } #endregion }
public static void SeedCourses(this CespContext context) { if (context.Courses.FirstOrDefault(c => c.Name == "Испанский язык для начинающих") == null) { var course = new CourseDto { Name = "Испанский язык для начинающих", DurationInfo = @"60 часов — 9 недель при занятиях по будням, 12 недель по выходным.", Description = @"Самое большое количество вопросов, конечно, задается теми, кто впервые начинает учить испанский язык. Что я буду знать после окончания курса? Как я смогу понимать репетитора, который говорит на испанском? Будем ли мы изучать грамматику и научусь ли я говорить? Существует множество методик для изучения иностранного языка как для взрослых так и для детей, и каждый выбирает ту, которая ему подходит больше. В своей программе обучения испанского языка для начинающих мы придерживаемся коммуникативной методики. Это значит, главная задача для нас: научить вас говорить по-испански. Начиная с первого занятия преподаватель общается со студентами на испанском языке. Вы увидите, что такие фразы как «Меня зовут Анна», «Я живу в Москве» выучить даже проще, чем алфавит. Это не значит, что мы не уделяем внимание теории. Каждый блок курса включает в себя лексику и грамматику. Не смотря на максимальное использование испанского языка во время занятия, вы всегда можете задать вопрос по-русски и получить объяснение, не боясь, что преподаватель вас не понимает. Вам не обязательно носить с собой словарь. Любое неизвестное слово вы можете спросить у преподавателя. Даже если он не знает перевод, он умеет рисовать, а также объяснять значение другими, известными вам словами. Закончив курс «Испанский для начинающих», вы уже сможете вести несложный диалог на испанском языке. Вы будете уметь представляться, описывать внешность, сможете спросить и объяснить дорогу, выразить свое отношение к предметам и ситуациям, рассказать о своих обычных занятиях. Выучите настоящее и одно прошедшее время глаголов.", }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Стандартный курс испанского") == null) { var photo = new FileDto { Name = "courses/standart_course.jpg", Info = "Стандартный курс испанского", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Стандартный курс испанского", DurationInfo = @"60 ак. часов — 2 занятия в неделю по 3,3 академических часа плюс перерыв 15 минут. Общая продолжительность курса — 9 недель.", Description = "Классический курс испанского языка в Москве продолжительностью около двух месяцев. Такой курс легко можно сочетать с работой или учебой. Количество занятий в неделю спланировано так, чтобы не отнимать у Вас много свободного времени, но и не позволить забыть пройденный материал.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); var group = new StudentGroupDto { IsAvailable = true, IsWorking = false, CourseId = course.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var price = new PriceDto { DiscountPer = 19, DiscountInfo = "на утренние группы.", CostInfo = "В стоимость входят учебные материалы.", StudentGroupId = group.Id, CurrencyId = (int)CurrencyEnum.Rub, }; context.Prices.Add(price); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Интенсивный курс испанского") == null) { var photo = new FileDto { Name = "courses/intensive_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Интенсивный курс испанского", DurationInfo = @"60 часов — 4 занятия в неделю по 3,3 академических часа плюс перерыв 15 минут. Общая продолжительность курса — 4,5 недели. ", Description = "Для тех, кто хочет выучить испанский язык в короткие сроки и располагает достаточным для этого временем, мы предлагаем интенсивные курсы разговорного испанского. Занятия проходят в нашем испанском центре 4 раза в неделю, скорость обучения увеличивается в два раза. При этом вы получаете курс в полном объеме без каких-либо сокращений.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); var group = new StudentGroupDto { CourseId = course.Id, IsAvailable = true, IsWorking = false, }; context.StudentGroups.Add(group); context.SaveChanges(); context.Prices.AddRange(new[] { new PriceDto { StudentGroupId = group.Id, DiscountPer = 20, CostInfo = "В стоимость входят учебные материалы.", }, new PriceDto { StudentGroupId = group.Id, Cost = 16000, CurrencyId = (int)CurrencyEnum.Rub, CostInfo = "(утренний интенсив), включая учебные материалы", }, new PriceDto { StudentGroupId = group.Id, Cost = 16500, CurrencyId = (int)CurrencyEnum.Rub, CostInfo = "(дневной интенсив), включая учебные материалы", }, new PriceDto { StudentGroupId = group.Id, Cost = 18000, CurrencyId = (int)CurrencyEnum.Rub, CostInfo = "(вечерний интенсив), включая учебные материалы", } }); context.SaveChanges(); context.Schedules.AddRange(new[] { new ScheduleDto { Day = "с понедельника по четверг", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), StudentGroupId = group.Id, }, new ScheduleDto { Day = "с понедельника по четверг", StartLessonTime = new TimeSpan(12, 15, 0), EndLessonTime = new TimeSpan(15, 0, 0), StudentGroupId = group.Id, }, new ScheduleDto { Day = "с понедельника по четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), StudentGroupId = group.Id, } } ); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Курс выходного дня") == null) { var photo = new FileDto { Name = "courses/weekend_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Курс выходного дня", DurationInfo = @"60 часов — 1 занятие в неделю по 5 академических часов плюс два перерыва по 10 минут. Общая продолжительность курса — 12 недель.", Description = "Хотите учить испанский или каталанский язык с нуля, но в течение недели загружены работой? Уделите ему один из выходных дней в нашей испанской школе. Занятия проводятся в первую или вторую половину дня, с перерывами на чай , во время которых Вы сможете передохнуть, а также насладиться нашей дружной испанской атмосферой.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); var group = new StudentGroupDto { CourseId = course.Id, IsAvailable = true, IsWorking = false, }; context.StudentGroups.Add(group); context.SaveChanges(); context.Prices.Add(new PriceDto { StudentGroupId = group.Id, CostInfo = "В стоимость входят учебные материалы.", } ); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Индивидуальные занятия с репетитором и курсы в мини-группах по испанскому языку у нас в центре или у вас дома" ) == null) { var photo = new FileDto { Name = "courses/individual_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Индивидуальные занятия с репетитором и курсы в мини-группах по испанскому языку у нас в центре или у вас дома", DurationInfo = @"Один уровень длится примерно 50 часов — частота и продолжительность занятий согласовывается с группой.", Description = "Занятия проходят индивидуально 1-2 человека или в мини-группах 3-4 человека. Продолжительность занятия и количество уроков в неделю зависит от решения группы. Такой вариант учить испанский язык подходит вам, если вы не можете подстроится под общее расписание или хотите заниматься со своей семьей или друзьями в менее шумной обстановке.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Испанский для детей") == null) { var photo = new FileDto { Name = "courses/children_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Испанский для детей", Description = "Методики преподавания испанского языка для детей отличается от методик для взрослых. Здесь большое внимание уделяется заданиям в игровой форме, используется много визуальных материалов. Мы проводим занятия для детей от 4 до 16 лет.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Каталонский язык") == null) { var photo = new FileDto { Name = "courses/catalonia_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Каталонский язык", Description = "Каталонский язык является официальным языком Каталонии, Балеарских островов, Арагона, Валенсии и Андорры. У нас Вы можете изучать каталанский, общаясь с носителями языка, узнать новые аспекты много-культурной Испании.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Португальский язык") == null) { var photo = new FileDto { Name = "courses/portugal_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Португальский язык", Description = @"На португальском языке говорят в Португалии, в Африке, в таких странах как: Ангола, Мозамбик, Гвинея Биссау, Сан Томе и Принсипи, Кабо Верде, а также в Бразилии, крупнейшей и высокоразвитой стране Латинской Америки. Отношения между Россией и Бразилией быстро развиваются, наши страны сотрудничают в области торговли, инвестиций, нефтегазовой промышленности, атомной энергии, а также биотехнологий, космонавтики, информационных и военных технологий. Поэтому изучение португальского языка – это ваше вложение в будущее, и его знание станет плюсом к Вашему профессиональному резюме. У нас работают педагоги ведущих вузов России, имеющие ученые степени и опыт работы в португалоговорящих странах, а также носители языка. Только мы обучаем португальскому языку по специальной методике специалистов с испанским языком.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Курс делового испанского и каталонского языков") == null) { var photo = new FileDto { Name = "courses/deal_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Курс делового испанского и каталонского языков", Description = @"Если у Вас, с учетом Вашей профессиональной деятельности, возникла необходимость освоить или вспомнить испанский язык и, в частности, лексический минимум (юридический, экономический, дипломатический, медицинский или просто бизнес), необходимый по работе - обращайтесь к нам! Пройдя курс обучения, основанный на Вашей профессиональной ориентации, Вы получите необходимый Вам объем знаний и уверенность в своих силах!", DurationInfo = "Частота и продолжительность занятий согласовывается с учетом Ваших пожеланий.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Корпоративный курс у вас в офисе") == null) { var photo = new FileDto { Name = "courses/inoffice_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Корпоративный курс у вас в офисе", Description = @"Если Вы с вашими коллегами по работе решили пройти курс делового испанского или каталонского языков с юридической, экономической, дипломатической или медицинской лексикой, мы вам обязательно поможем. Лучшие преподаватели нашего центра направятся к вам офис и предложат вам эффективную методику усвоения языка не отрываясь от рабочего места.", DurationInfo = "Частота и продолжительность занятий согласовывается с учетом Ваших пожеланий.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Занятия по СКАЙП") == null) { var photo = new FileDto { Name = "courses/skype_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Занятия по СКАЙП", Description = @"Эта самая удобная учебная программа для широкого круга слушателей, как для начинающих так и для имеющих опыт изучения языка, которая включает в себя комплексный подход к изучению языка (грамматика, необходимая лексика для повседневного общения, путешествий или работы , восприятие на слух аудиоматериалов, устная речь, чтение, написание сочинений и эссе и перевод ). Эта методика разработана в соответствии с международными стандартами обучения европейских языков.", DurationInfo = "Частота и продолжительность занятий согласовывается с учетом Ваших пожеланий.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Подготовка к ЕГЭ и к DELE") == null) { var photo = new FileDto { Name = "courses/ege_dele_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Подготовка к ЕГЭ и к DELE", Description = @"Уважаемые родители! Если Ваши дети оканчивают школу, и им предстоит сдача ЕГЭ по испанскому языку, не волнуйтесь, а обращайтесь к нам. Наши преподаватели подготовят ваших детей, дадут им необходимые знания, чтобы успешно сдать экзамен и при этом, чувствовать себя спокойно и уверенно. DELE – международная система обучения испанскому языку, предполагающая получение сертификата, действующего во всех странах мира. Мы подготовим Вас и/или ваших детей к сдаче экзаменов на получение этого сертификата нужного Вам уровня. Обратите внимание, что занятия проводятся не только в нашем учебном центре, но и, по Вашему желанию, у вас дома.", DurationInfo = "Частота и продолжительность занятий согласовывается с учетом Ваших пожеланий.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } if (context.Courses.FirstOrDefault(c => c.Name == "Письменный (в том числе срочный) или устный перевод") == null) { var photo = new FileDto { Name = "courses/translate_course.jpg", }; context.Files.Add(photo); context.SaveChanges(); var course = new CourseDto { Name = "Письменный (в том числе срочный) или устный перевод", Description = @"Дополнительная услуга, оказываемая только нашим Центром, – письменный (в том числе срочный) или устный перевод по любой тематике и любого уровня сложности на/с испанского и каталонского языков.", PhotoId = photo.Id, }; context.Courses.Add(course); context.SaveChanges(); } }
public static void SeedStudentGroupsCatalan(this CespContext context) { var bunch = context .GroupBunches .FirstOrDefault(grb => grb.Name == "Группы каталонского языка"); if (context.StudentGroups.Any( gr => gr.GroupBunchId == bunch.Id)) { return; } var course = context.Courses.FirstOrDefault(c => c.Name == "Каталонский язык"); var levelA1 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A1"); var levelB1 = context .LanguageLevels .FirstOrDefault(l => l.Name == "B1.1"); #region { var group = new StudentGroupDto { CourseId = course.Id, IsWorking = true, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = bunch.Id, Description = "(30-36 ак.ч.)", }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "пятница", StartLessonTime = new TimeSpan(18, 45, 0), EndLessonTime = new TimeSpan(21, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); var price = new PriceDto { Cost = 18000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, IsWorking = true, IsAvailable = true, LanguageLevelId = levelB1.Id, GroupBunchId = bunch.Id, Description = "(30-36 ак.ч.)", }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(14, 0, 0), EndLessonTime = new TimeSpan(17, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); var price = new PriceDto { Cost = 18000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion }
public async Task <ActionResponse <StudentGroupDto> > Update([FromBody] StudentGroupDto request) { return(await studentGroupService.Update(request)); }
public static void SeedStudentGroupsChild(this CespContext context) { var groupChild = context .GroupBunches .FirstOrDefault(grb => grb.Name == "Детские группы"); if (context.StudentGroups.Any( gr => gr.GroupBunchId == groupChild.Id)) { return; } var course = context.Courses.FirstOrDefault(c => c.Name == "Испанский для детей"); var levelA1 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A1"); var levelA2 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A2.1"); // var timeUnit = context.TimeUnits.FirstOrDefault(u => u.Name == "ак.ч"); #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2018, 9, 18), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupChild.Id, Description = "9 - 11 лет", }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(14, 0, 0), EndLessonTime = new TimeSpan(16, 10, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var duration = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 2.5, // TimeUnitId = timeUnit.Id, // }; // context.GroupDurations.Add(duration); // context.SaveChanges(); var price = new PriceDto { Cost = 1300, PaymentPeriod = "урок", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2018, 9, 18), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA2.Id, GroupBunchId = groupChild.Id, Description = "9 - 11 лет", }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(14, 30, 0), EndLessonTime = new TimeSpan(16, 30, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var duration = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 2.5, // TimeUnitId = timeUnit.Id, // }; // context.GroupDurations.Add(duration); // context.SaveChanges(); var price = new PriceDto { Cost = 1300, PaymentPeriod = "урок", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2018, 9, 18), IsWorking = true, IsAvailable = true, LanguageLevelId = levelA2.Id, GroupBunchId = groupChild.Id, Description = "7 - 8 лет", }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(14, 30, 0), EndLessonTime = new TimeSpan(16, 10, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var duration = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 2, // TimeUnitId = timeUnit.Id, // }; // context.GroupDurations.Add(duration); // context.SaveChanges(); var price = new PriceDto { Cost = 1300, PaymentPeriod = "урок", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion }
public async Task <IActionResult> UpdateStudentGroup(long id, StudentGroupDto data) { var updatedStudentGroup = await _studentGroupService.UpdateStudentGroupAsync(id, data, _protector.Unprotect(Request.Cookies["accessToken"])); return(RedirectToAction("AllStudentGroups", "StudentGroup")); }
public static void SeedStudentGroupsYoung(this CespContext context) { var groupYoung = context .GroupBunches .FirstOrDefault(grb => grb.Name == "Молодежные и подростковые группы"); if (context.StudentGroups.Any( gr => gr.GroupBunchId == groupYoung.Id)) { return; } var timeGroupWeekend= context .GroupTimes .FirstOrDefault(gt => gt.Name == "Курс выходного дня"); var course = context.Courses.FirstOrDefault(c => c.Name == "Испанский для детей"); var levelA1 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A1"); var levelA2 = context .LanguageLevels .FirstOrDefault(l => l.Name == "A2.1"); // var timeUnitAH = context.TimeUnits.FirstOrDefault(u => u.Name == "ак.ч"); // var timeUnitW = context.TimeUnits.FirstOrDefault(u => u.Name == "нед"); // var timeUnitM = context.TimeUnits.FirstOrDefault(u => u.Name == "мес"); #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2019, 9, 24), IsWorking = false, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupYoung.Id, Description = "Испанский язык для подростков (12-15 лет)", GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationM = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 3, // TimeUnitId = timeUnitM.Id, // }; // context.GroupDurations.Add(durationM); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12500, PaymentPeriod = "1/2 курса", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2019, 9, 24), IsWorking = false, IsAvailable = true, LanguageLevelId = levelA2.Id, GroupBunchId = groupYoung.Id, Description = "Испанский язык для подростков (12-15 лет)", GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationM = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 3, // TimeUnitId = timeUnitM.Id, // }; // context.GroupDurations.Add(durationM); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12500, PaymentPeriod = "1/2 курса", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2019, 9, 18), IsWorking = false, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupYoung.Id, Description = "Молодежная группа испанского языка (15-22 годя) ", GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(10, 0, 0), EndLessonTime = new TimeSpan(14, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationM = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 3, // TimeUnitId = timeUnitM.Id, // }; // context.GroupDurations.Add(durationM); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12500, PaymentPeriod = "1/2 курса", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2019, 9, 18), IsWorking = false, IsAvailable = true, LanguageLevelId = levelA2.Id, GroupBunchId = groupYoung.Id, Description = "Молодежная группа испанского языка (15-22 годя) ", GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(10, 0, 0), EndLessonTime = new TimeSpan(14, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationM = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 3, // TimeUnitId = timeUnitM.Id, // }; // context.GroupDurations.Add(durationM); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12500, PaymentPeriod = "1/2 курса", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2019, 9, 24), IsWorking = false, IsAvailable = true, LanguageLevelId = levelA1.Id, GroupBunchId = groupYoung.Id, Description = "Молодежная группа испанского языка (15-22 годя) ", GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationM = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 3, // TimeUnitId = timeUnitM.Id, // }; // context.GroupDurations.Add(durationM); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12500, PaymentPeriod = "1/2 курса", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = course.Id, Start = new DateTime(2019, 9, 24), IsWorking = false, IsAvailable = true, LanguageLevelId = levelA2.Id, GroupBunchId = groupYoung.Id, Description = "Молодежная группа испанского языка (15-22 годя) ", GroupTimeId = timeGroupWeekend.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationM = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 3, // TimeUnitId = timeUnitM.Id, // }; // context.GroupDurations.Add(durationM); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12500, PaymentPeriod = "1/2 курса", CurrencyId = (int) CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion }
public static void SeedStudentGroupsStudent(this CespContext context) { var groupScheduleAndPrice = context .GroupBunches .FirstOrDefault(grb => grb.Name == "Расписание и цены"); if (context.StudentGroups.Any( gr => gr.GroupBunchId == groupScheduleAndPrice.Id)) { return; } var courseIntensive = context.Courses.FirstOrDefault(c => c.Name == "Интенсивный курс испанского"); // var timeUnitAH = context.TimeUnits.FirstOrDefault(u => u.Name == "ак.ч"); // var timeUnitW = context.TimeUnits.FirstOrDefault(u => u.Name == "нед"); #region { var group = new StudentGroupDto { CourseId = courseIntensive.Id, IsWorking = true, IsAvailable = true, Description = "Интенсивный летний курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "с понедельника по четверг", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 4.5, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price = new PriceDto { Cost = 19000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, DiscountPer = 20, }; context.Prices.Add(price); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseIntensive.Id, IsWorking = true, IsAvailable = true, Description = "Интенсивный летний курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "с понедельника по четверг", StartLessonTime = new TimeSpan(12, 15, 0), EndLessonTime = new TimeSpan(15, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 4.5, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price = new PriceDto { Cost = 19500, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, DiscountPer = 20, }; context.Prices.Add(price); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseIntensive.Id, IsWorking = true, IsAvailable = true, Description = "Интенсивный летний курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "с понедельника по четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 4.5, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price = new PriceDto { Cost = 20000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion // Полуинтенсив #region { var group = new StudentGroupDto { IsWorking = true, IsAvailable = true, Description = "Курс полуинтенсив", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда, пятница", StartLessonTime = new TimeSpan(12, 0, 0), EndLessonTime = new TimeSpan(14, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 8, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price = new PriceDto { Cost = 20000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { IsWorking = true, IsAvailable = true, Description = "Курс полуинтенсив", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда, пятница", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 8, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price); context.SaveChanges(); } #endregion //Стандартный курс var courseStandart = context.Courses.FirstOrDefault(c => c.Name == "Стандартный курс испанского"); #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 9, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 21000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 11750, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(9, 0, 0), EndLessonTime = new TimeSpan(11, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 9, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 21000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 11750, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "понедельник, среда", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 9, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12750, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseStandart.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "вторник, четверг", StartLessonTime = new TimeSpan(19, 0, 0), EndLessonTime = new TimeSpan(21, 45, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 9, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 23000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 12750, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion // Курс выходного дня var courseWeekend = context.Courses.FirstOrDefault(c => c.Name == "Курс выходного дня"); #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(10, 0, 0), EndLessonTime = new TimeSpan(14, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 26000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 14250, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(10, 0, 0), EndLessonTime = new TimeSpan(14, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 26000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 14250, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "суббота", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 26000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 14250, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseWeekend.Id, IsWorking = true, IsAvailable = true, Description = "Стандартный курс", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "воскресенье", StartLessonTime = new TimeSpan(15, 0, 0), EndLessonTime = new TimeSpan(19, 0, 0), }; context.Schedules.Add(schedule); context.SaveChanges(); // var durationW = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 12, // TimeUnitId = timeUnitW.Id, // }; // context.GroupDurations.Add(durationW); // context.SaveChanges(); // var durationAH = new GroupDurationDto // { // StudentGroupId = group.Id, // Duration = 60, // TimeUnitId = timeUnitAH.Id, // }; // context.GroupDurations.Add(durationAH); // context.SaveChanges(); var price1 = new PriceDto { Cost = 26000, PaymentPeriod = "курс", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 14250, PaymentPeriod = "1/2 курса", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); } #endregion // Индивидуальные занятия и мини-группы var courseIndividual = context.Courses.FirstOrDefault(c => c.Name.Contains("Индивидуальные занятия")); #region { var group = new StudentGroupDto { CourseId = courseIndividual.Id, IsWorking = true, IsAvailable = true, Description = "Индивидуальные занятия и мини-группы", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "будни до 18.00", }; context.Schedules.Add(schedule); context.SaveChanges(); var price1 = new PriceDto { Cost = 1400, PaymentPeriod = "1 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 800, PaymentPeriod = "2 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); var price3 = new PriceDto { Cost = 500, PaymentPeriod = "3 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price3); context.SaveChanges(); var price4 = new PriceDto { Cost = 400, PaymentPeriod = "4-5 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price4); context.SaveChanges(); } #endregion #region { var group = new StudentGroupDto { CourseId = courseIndividual.Id, IsWorking = true, IsAvailable = true, Description = "Индивидуальные занятия и мини-группы", GroupBunchId = groupScheduleAndPrice.Id, }; context.StudentGroups.Add(group); context.SaveChanges(); var schedule = new ScheduleDto { StudentGroupId = group.Id, Day = "будни после 18.00 и выходные", }; context.Schedules.Add(schedule); context.SaveChanges(); var price1 = new PriceDto { Cost = 1600, PaymentPeriod = "1 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price1); context.SaveChanges(); var price2 = new PriceDto { Cost = 900, PaymentPeriod = "2 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price2); context.SaveChanges(); var price3 = new PriceDto { Cost = 600, PaymentPeriod = "3 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price3); context.SaveChanges(); var price4 = new PriceDto { Cost = 450, PaymentPeriod = "4-5 чел.", CurrencyId = (int)CurrencyEnum.Rub, StudentGroupId = group.Id, }; context.Prices.Add(price4); context.SaveChanges(); } #endregion }