Example #1
0
 public PollController(
     IPollRepository pollRepository,
     IMapper mapper,
     IFLikeContext context
     )
 {
     _pollRepository = pollRepository;
     _mapper         = mapper;
     _context        = context;
 }
Example #2
0
 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();
 }
Example #3
0
        // 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");
            });
        }
Example #4
0
 public CountryRepository(IFLikeContext context)
     : base(context)
 {
 }
 public PollItemRepository(IFLikeContext iFLikeContext) : base(iFLikeContext)
 {
 }
Example #6
0
 public PollResultRepository(IFLikeContext iFLikeContext) : base(iFLikeContext)
 {
 }
Example #7
0
 public RepositoryBase(IFLikeContext iFLikeContext)
 {
     Context = iFLikeContext;
     DbSet   = Context.Set <TEntity>();
 }
 public IpLocationRepository(IFLikeContext iFLikeContext)
 {
     Context = iFLikeContext;
 }
Example #9
0
 public ImageRepository(IFLikeContext iFLikeContext) : base(iFLikeContext)
 {
 }
Example #10
0
 public PollRepository(IFLikeContext context)
     : base(context)
 {
 }