Пример #1
0
        public static void EnsureSeedDataForContext(this ChurchAppContext context)
        {
            if (context.DonationTypes.Any())
            {
                return;
            }

            var donationTypes = new List <DonationType>()
            {
                new DonationType()
                {
                    Type = "Tithe"
                },
                new DonationType()
                {
                    Type = "Offering"
                },
                new DonationType()
                {
                    Type = "Pledge"
                }
            };

            context.AddRange(donationTypes);
            context.SaveChanges();
        }
 public AccountsController(UserManager <AppUser> userManager,
                           ChurchAppContext context,
                           SignInManager <AppUser> signInManager,
                           IMapper mapper,
                           JwtSettings jwtSettings)
 {
     _context       = context;
     _userManager   = userManager;
     _mapper        = mapper;
     _signInManager = signInManager;
     _jwtSettings   = jwtSettings;
 }
Пример #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, ChurchAppContext churchAppContext)
        {
            if (_env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            AddressTypeSeed.EnsureSeedDataForContext(churchAppContext);
            DonationTypeSeed.EnsureSeedDataForContext(churchAppContext);
            app.UseHttpsRedirection();
            app.UseCors("CorsPolicy");
            app.UseAuthentication();
            app.UseMvc();
        }
        public static void EnsureSeedDataForContext(this ChurchAppContext context)
        {
            if (context.DonationTypes.Any())
            {
                return;
            }

            var addressTypes = new List <AddressType>()
            {
                new AddressType()
                {
                    Name = "Home"
                },
                new AddressType()
                {
                    Name = "Work"
                }
            };

            context.AddRange(addressTypes);
            context.SaveChanges();
        }
Пример #5
0
 public AddressRepository(ChurchAppContext churchAppContext)
 {
     _churchAppContext = churchAppContext;
 }
 public DonationRepository(ChurchAppContext churchAppContext)
 {
     _churchAppContext = churchAppContext;
 }
Пример #7
0
 public PersonRepository(ChurchAppContext context)
 {
     _context = context;
 }