Example #1
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new RazorPagesIgnis.Areas.Identity.Data.IdentityContext(
                serviceProvider.GetRequiredService <
                    DbContextOptions <RazorPagesIgnis.Areas.Identity.Data.IdentityContext> >()))
     {
         if (context.Project.Any())
         {
             return;
         }
         ProjectsSeeder(serviceProvider);
     }
 }
Example #2
0
        public static void ProjectsSeeder(IServiceProvider serviceProvider)
        {
            using (var context = new RazorPagesIgnis.Areas.Identity.Data.IdentityContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <RazorPagesIgnis.Areas.Identity.Data.IdentityContext> >())){
                if (context.Project.Any())
                {
                    return;
                }
                ;

                var Projects = new Project[] {
                    new Project {
                        Specialty   = "Fotógrafo",
                        Level       = "Avanzado",
                        Description = "Buscamos fotógrafo para sesión de publicidad.",
                        NHours      = 3,
                    },
                    new Project {
                        Specialty   = "Fotógrafo",
                        Level       = "Intermedio",
                        Description = "Se necesita fotógrafo para congreso a llevarse a cabo en la institución.",
                        NHours      = 1,
                    },
                    new Project {
                        Specialty   = "Sonidista",
                        Level       = "Intermedio",
                        Description = "Se necesita camarógrafo para la grabación de videoclip promocional.",
                        NHours      = 7,
                    },
                };
                foreach (Project p in Projects)
                {
                    Client query = context.Client
                                   .Where(s => s.UserName == "*****@*****.**")
                                   .FirstOrDefault <Client>();
                    p.Client = query;
                    context.Project.Add(p);
                }
                ;
                context.SaveChanges();
            }
        }
Example #3
0
 public IndexModel(RazorPagesIgnis.Areas.Identity.Data.IdentityContext context)
 {
     _context = context;
 }