예제 #1
0
        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));
 }
예제 #3
0
        //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));
        }
예제 #4
0
 public StaffController(kindergartenContext context, CacheProvider cache)
 {
     _context = context;
     _cache   = cache;
 }
 public PositionsController(kindergartenContext context, CacheProvider cache)
 {
     _context = context;
     _cache   = cache;
 }
예제 #6
0
 public ChildrenController(kindergartenContext context)
 {
     _context = context;
 }
예제 #7
0
 public ParentsController(kindergartenContext context)
 {
     _context = context;
 }
예제 #8
0
 public GroupTypesController(kindergartenContext context, CacheProvider cache)
 {
     _context = context;
     _cache   = cache;
 }