public IActionResult Delete(AbiturientStatus abiturientStatus) { _context.AbiturientStatuses.Remove(abiturientStatus); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); }
/// <summary> /// Инициализация таблицы "Статусы абитуриентов" /// </summary> /// <param name="serviceProvider"></param> /// <param name="configuration"></param> /// <returns></returns> public static async Task CreateAbiturientStatuses(IServiceProvider serviceProvider, IConfiguration configuration) { using (var serviceScope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AppIdentityDBContext context = serviceScope.ServiceProvider.GetService <AppIdentityDBContext>(); #region Инициализация таблицы "Статусы абитуриентов" if (!await context.AbiturientStatuses.AnyAsync()) { var row01 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.NewAbiturient, AbiturientStatusName = "Новый абитуриент" }; var row02 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.ConfirmedAbiturient, AbiturientStatusName = "Подтверждённый абитуриент" }; var row03 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.Zachislenie, AbiturientStatusName = "К зачислению" }; var row04 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.VObrabotke, AbiturientStatusName = "В обработке" }; var row05 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.KEkzamenam, AbiturientStatusName = "Экзамен" }; var row06 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.AddedToStudGroup, AbiturientStatusName = "Экзамен дистанционно" }; var row07 = new AbiturientStatus { AbiturientStatusId = (int)AbiturientStatusEnum.AddedToStudGroup, AbiturientStatusName = "Зачислен и добавлен в студенческую группу" }; await context.AbiturientStatuses.AddRangeAsync( row01, row02, row03, row04, row05, row06, row07 ); await context.SaveChangesAsync(); } #endregion } }