Exemplo n.º 1
0
        public void InitializeTests()
        {
            this.context = MockDbContext.GetContext();
            this.service = new AdminRewardsService(context, MockAutoMapper.GetMapper());

            CreateInitialEvents();
        }
Exemplo n.º 2
0
        public static void SeedData(this IApplicationBuilder app)
        {
            using (IServiceScope serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                AbraksContext db = serviceScope.ServiceProvider.GetService <AbraksContext>();

                DanceType initialDance = db.DanceTypes.FirstOrDefault(t => t.Name == "Folklor");
                if (initialDance == null)
                {
                    db.DanceTypes.Add(new DanceType()
                    {
                        Name = "Folklor"
                    });
                    db.DanceTypes.Add(new DanceType()
                    {
                        Name = "Salsa"
                    });
                }
                db.SaveChanges();

                Event initialEvent = db.Events.FirstOrDefault(c => c.Name == "Gergiovden");
                if (initialEvent == null)
                {
                    db.Events.Add(new Event()
                    {
                        Name      = "Gergiovden",
                        Place     = "Stefanovo",
                        Address   = "Stefanovo",
                        Dance     = initialDance,
                        PosterUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg",
                        StartDate = DateTime.Now,
                        EndDate   = DateTime.Now.AddDays(2)
                    });
                }
                db.SaveChanges();
            }
        }
Exemplo n.º 3
0
 public AdminRewardsService(AbraksContext dbContext, IMapper mapper)
     : base(dbContext, mapper)
 {
 }
Exemplo n.º 4
0
 public UsersController(AbraksContext context, IMapper mapper, UserManager <User> userManager)
 {
     this.context     = context;
     this.mapper      = mapper;
     this.userManager = userManager;
 }
Exemplo n.º 5
0
 public AdminEventsService(AbraksContext dbContext, IMapper mapper)
     : base(dbContext, mapper)
 {
 }
Exemplo n.º 6
0
 public DancerCommentsService(AbraksContext dbContext, IMapper mapper)
     : base(dbContext, mapper)
 {
 }
Exemplo n.º 7
0
 protected BaseAbraksService(AbraksContext dbContext, IMapper mapper)
 {
     this.DbContext = dbContext;
     this.Mapper    = mapper;
 }