Example #1
0
 public IActionResult SetLmsEventTypeId(LmsEventType lmsEventType)
 {
     return(RedirectToAction(nameof(SetLmsEventId), new { lmsEventType.LmsEventTypeId }));
 }
        /// <summary>
        /// Инициализация таблицы "Типы событий СДО"
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static async Task CreateLmsEventTypes(IServiceProvider serviceProvider, IConfiguration configuration)
        {
            using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>();

                #region Инициализация таблицы "Типы событий СДО"
                if (!await context.LmsEventTypes.AnyAsync())
                {
                    /////////////////////////////////////// Приём ///////////////////////////
                    var Row11 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.Priem_EntranceTest,
                        LmsEventTypeName    = "Вступительное испытание",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.Priem
                    };

                    ////////////////////////////////// Учебный процесс ///////////////////////

                    var Row21 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.StudyingProccess_Lecture,
                        LmsEventTypeName    = "Лекция",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.StudyingProccess
                    };

                    var Row22 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.StudyingProccess_PracticalLesson,
                        LmsEventTypeName    = "Практическое занятие",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.StudyingProccess
                    };

                    var Row23 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.StudyingProccess_LaboratoryWork,
                        LmsEventTypeName    = "Лабораторная работа",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.StudyingProccess
                    };

                    ////////////////////////////////// Текущая аттестация ///////////////////////
                    var Row31 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.CurrentCertification_Test,
                        LmsEventTypeName    = "Текущая аттестация - тест",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.CurrentCertification
                    };

                    /////////////////////////////// Промежуточная аттестация ///////////////////////
                    var Row41 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.IntermediateCertification_Midterm,
                        LmsEventTypeName    = "Промежуточная аттестация - зачет",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.IntermediateCertification
                    };
                    var Row42 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.IntermediateCertification_MidtermWithMark,
                        LmsEventTypeName    = "Промежуточная аттестация - зачет с оценкой",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.IntermediateCertification
                    };
                    var Row43 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.IntermediateCertification_Exam,
                        LmsEventTypeName    = "Промежуточная аттестация - экзамен",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.IntermediateCertification
                    };
                    /////////////////////////// Государственная итоговая аттестация ///////////////////////
                    var Row51 = new LmsEventType
                    {
                        LmsEventTypeId      = (int)LmsEventTypesEnum.StateFinalCertification_FinalQualifyingWorkDefense,
                        LmsEventTypeName    = "Государственная итоговая аттестация - защита ВКР",
                        LmsEventTypeGroupId = (int)LmsEventTypeGroupsEnum.StateFinalCertification
                    };


                    await context.LmsEventTypes.AddRangeAsync(
                        Row11,
                        Row21, Row22, Row23,
                        Row31,
                        Row41, Row42, Row43,
                        Row51
                        );

                    await context.SaveChangesAsync();
                }
                #endregion
            }
        }