public static void Initialize(kindergartenContext context) { context.Database.EnsureCreated(); // Проверка занесены ли данные if (context.TypesOfGroups.Any()) { return; // База данных инициализирована } context.AddRange( new TypesOfGroups() { Name = "Name1", Description = "Description1" }, new TypesOfGroups() { Name = "Name2", Description = "Description2" }, new TypesOfGroups() { Name = "Name3", Description = "Description3" } ); context.SaveChanges(); }
public Task Invoke(HttpContext httpContext, kindergartenContext db) { if (!(httpContext.Session.Keys.Contains("starting"))) { DbInitialize.Initialize(db); httpContext.Session.SetString("starting", "Yes"); } return(_next.Invoke(httpContext)); }
//public async Task Invoke(HttpContext context) //{ // var token = context.Request.Query["token"]; // if (string.IsNullOrWhiteSpace(token) || token != pattern) // { // context.Response.StatusCode = 403; // await context.Response.WriteAsync("Token is invalid"); // } // else // { // await _next.Invoke(context); // } //} public Task Invoke(HttpContext context, kindergartenContext dbContext) { if (!(context.Session.Keys.Contains("starting"))) { DbInitializer.Initialize(dbContext); context.Session.SetString("starting", "Yes"); } // Call the next delegate/middleware in the pipeline return(_next.Invoke(context)); }
public StaffController(kindergartenContext context, CacheProvider cache) { _context = context; _cache = cache; }
public PositionsController(kindergartenContext context, CacheProvider cache) { _context = context; _cache = cache; }
public ChildrenController(kindergartenContext context) { _context = context; }
public ParentsController(kindergartenContext context) { _context = context; }
public GroupTypesController(kindergartenContext context, CacheProvider cache) { _context = context; _cache = cache; }