public PollController( IPollRepository pollRepository, IMapper mapper, IFLikeContext context ) { _pollRepository = pollRepository; _mapper = mapper; _context = context; }
public void Seed(IFLikeContext context) { if (context.Countries.Any()) { return; } Country[] countries = { new Country() { CountryCode = "dk", IsAllowed = true, Name = "Denmark" }, new Country() { CountryCode = "no", IsAllowed = true, Name = "Norway" }, new Country() { CountryCode = "se", IsAllowed = true, Name = "Sweden" }, new Country() { CountryCode = "fi", IsAllowed = true, Name = "Finland" }, new Country() { CountryCode = "es", IsAllowed = true, Name = "Estonia" }, new Country() { CountryCode = "lv", IsAllowed = true, Name = "Latvia" }, new Country() { CountryCode = "lt", IsAllowed = true, Name = "Lithuania" }, }; foreach (var country in countries) { context.Add(country); } context.SaveChanges(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IFLikeContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "images", template: "images/{imageID}/{*filename}", defaults: new { controller = "PollImage", action = "Index" }); }); List <IIFLikeSeeder> seeders = new List <IIFLikeSeeder> { new CountrySeeder() }; seeders.ForEach(s => s.Seed(context)); app.UseSignalR(routes => { routes.MapHub <VoteHub>("votehub"); }); }
public CountryRepository(IFLikeContext context) : base(context) { }
public PollItemRepository(IFLikeContext iFLikeContext) : base(iFLikeContext) { }
public PollResultRepository(IFLikeContext iFLikeContext) : base(iFLikeContext) { }
public RepositoryBase(IFLikeContext iFLikeContext) { Context = iFLikeContext; DbSet = Context.Set <TEntity>(); }
public IpLocationRepository(IFLikeContext iFLikeContext) { Context = iFLikeContext; }
public ImageRepository(IFLikeContext iFLikeContext) : base(iFLikeContext) { }
public PollRepository(IFLikeContext context) : base(context) { }