public UpdateMatchDetailsCommandHandler(ClubsContext context, IMapper mapper
                                         , ILogger <UpdateMatchDetailsCommandHandler> logger)
 {
     _Context = context;
     _Mapper  = mapper;
     _Logger  = logger;
 }
예제 #2
0
 public SuperAdminController(UserManager <User> userManager, SignInManager <User> signInManager, IOptions <ApplicationSettings> appSettings, ClubsContext context)
 {
     _userManager   = userManager;
     _singInManager = signInManager;
     _appSettings   = appSettings.Value;
     _context       = context;
 }
예제 #3
0
 static void Main(string[] args)
 {
     using (ClubsContext db = new ClubsContext())
     {
         Console.WriteLine("No of Clubs {0}", db.Clubs.Count());
     }
 }
예제 #4
0
 public CreateMatchCommandHandler(ClubsContext context, IMapper mapper,
                                  ILogger <CreateMatchCommandHandler> logger)
 {
     _Context = context;
     _Mapper  = mapper;
     _Logger  = logger;
 }
예제 #5
0
 protected BaseMatchCreator(ILogger <IMatchCreator> logger
                            , ClubsContext context
                            , IMapper mapper)
 {
     _Logger    = logger;
     _DbContext = context;
     _Mapper    = mapper;
 }
예제 #6
0
        public async Task PlaySeason(string season)
        {
            var s = new Season()
            {
                Name = season
            };
            ClubsContext dbContext = new ClubsContext();

            dbContext.Entry(s).State = EntityState.Added;
            dbContext.SaveChanges();
            MainController mainController = new MainController(dbContext);

            mainController.SeasonPlay(s);

            await Clients.All.SendAsync("PlaySeason", "Season is played look at stats");
        }
예제 #7
0
        public void OnResourceExecuting(ResourceExecutingContext context)
        {
            string token = context.HttpContext.Request.Headers["token"];

            if (token == null)
            {
                throw new Exception("Necessary HTTP headers not present!");
            }

            ClubsContext dbContext = new ClubsContext();
            var          user      = dbContext.Users.FirstOrDefault(u => u.Token == token);

            if (user == null)
            {
                throw new Exception("Incorrect token or expired!");
            }
        }
예제 #8
0
        private async static Task SeedLocations(ClubsContext context)
        {
            if (!context.Locations.Any())
            {
                var allenPark = new Location("Allen Park", "45 Castle Rd", "Antrim", "BT41 4NA", true,
                                             "https://www.tobermore.co.uk/professional/project/allen-park-leisure-centre/");
                context.Locations.Add(allenPark);

                var armaghL = new Location("Orchard Leisure Centre", "37-39 Folly Ln", "Armagh", "BT60 1AT", true,
                                           "https://getactiveabc.com/facility/orchard-leisure-centre/");
                context.Locations.Add(armaghL);

                var antrimForum = new Location("Antrim Forum", "50 Stiles Way", "Antrim", "BT41 2UB", true,
                                               "https://antrimandnewtownabbey.gov.uk/reopening-of-our-leisure-centres/");
                context.Locations.Add(antrimForum);

                await context.SaveChangesAsync();
            }
        }
        private void SeedStudentMembers(ClubsContext context)
        {
            List <Club> clubs = context.Clubs.ToList();

            foreach (var club in clubs)
            {
                //takes all the student ID's from the student table and associates a Random Guid with it
                var randomStudentSet = context.Students
                                       .Select(s => new { s.StudentID, r = Guid.NewGuid() });

                //takes in the set of student Ids and sorts it based on the Guid. Because Guids are random this will give us a random list of students
                List <string> subset = randomStudentSet
                                       .OrderBy(s => s.r)
                                       .Select(s => s.StudentID)
                                       .Take(10)
                                       .ToList();

                List <Student> selectedStudents = new List <Student>();

                foreach (string s in subset)
                {
                    selectedStudents.Add(context.Students.First(st => st.StudentID == s));
                }

                foreach (Student s in selectedStudents)
                {
                    context.Members.AddOrUpdate(m => m.StudentID,
                                                new Member
                    {
                        AssociatedClub = club.ClubId,
                        StudentID      = s.StudentID
                    });
                    context.SaveChanges();
                }

                context.SaveChanges();
            }
        }
 public SDNameAddressController(ClubsContext context)
 {
     _context = context;
 }
예제 #11
0
 /// <summary>
 /// constructor for OLArtistController to initialize the controller
 /// </summary>
 /// <param name="context">provided to the controller by Dependency Injection in Startup.cs</param>
 public OLArtistController(ClubsContext context)
 {
     _context = context;
 }
 public ImagesController(ClubsContext context)
 {
     _context = context ?? throw new Exception();
 }
예제 #13
0
 public AddressesController(ClubsContext context)
 {
     _context = context;
 }
예제 #14
0
 public NPCountryController(ClubsContext context)
 {
     _context = context;
 }
예제 #15
0
 public NPStylesController(ClubsContext context)
 {
     _context = context;
 }
 public SDCountriesController(ClubsContext context)
 {
     _context = context;
 }
예제 #17
0
 public CreateTeamCommandHandler(ClubsContext context, IMapper mapper)
 {
     _Context = context;
     _Mapper  = mapper;
 }
예제 #18
0
 /// <summary>
 /// constructor for OLInstrumentController to initialize the controller
 /// </summary>
 /// <param name="context">provided to the controller by Dependency Injection in Startup.cs</param>
 public OLInstrumentController(ClubsContext context)
 {
     _context = context;
 }
예제 #19
0
        private async static Task SeedClubsAndMembers(ClubsContext context)
        {
            if (!context.Clubs.Any())
            {
                var RandoxIT = new Club()
                {
                    Name = "Rdox IT", Creator = "Sean Rafferty"
                };
                var Members = new List <Member>();
                var Sean    = new Member()
                {
                    FirstName = "Sean", LastName = "Rafferty", Email = "*****@*****.**", Club = RandoxIT, Rating = 50.2
                };
                Members.Add(Sean);
                var Sean2 = new Member()
                {
                    FirstName = "Sean", LastName = "Personal", Email = "*****@*****.**", Club = RandoxIT, Rating = 45.1
                };
                Members.Add(Sean2);
                var SeanWork = new Member()
                {
                    FirstName = "Sean", LastName = "Rdx", Email = "*****@*****.**", Club = RandoxIT, Rating = 99.9
                };
                Members.Add(SeanWork);
                var Francy = new Member()
                {
                    FirstName = "Francy", LastName = "Donald", Email = "*****@*****.**", Club = RandoxIT, Rating = 85
                };
                Members.Add(Francy);
                var Andy = new Member()
                {
                    FirstName = "Andy", LastName = "Williamson", Email = "*****@*****.**", Club = RandoxIT, Rating = 72
                };
                Members.Add(Andy);
                var Ross = new Member()
                {
                    FirstName = "Ross", LastName = "Bratton", Email = "*****@*****.**", Club = RandoxIT, Rating = 65
                };
                Members.Add(Ross);
                var Conor = new Member()
                {
                    FirstName = "Conor", LastName = "Devlin", Email = "*****@*****.**", Club = RandoxIT, Rating = 65
                };
                Members.Add(Conor);
                var David = new Member()
                {
                    FirstName = "David", LastName = "McCrory", Email = "*****@*****.**", Club = RandoxIT, Rating = 70
                };
                Members.Add(David);
                var Steve = new Member()
                {
                    FirstName = "Steve", LastName = "Kennedy", Email = "*****@*****.**", Club = RandoxIT, Rating = 70
                };
                Members.Add(Steve);
                var Mike = new Member()
                {
                    FirstName = "Mike", LastName = "Hayes", Email = "*****@*****.**", Club = RandoxIT, Rating = 78
                };
                Members.Add(Mike);
                var Oran = new Member()
                {
                    FirstName = "Oran", LastName = "McMenamin", Email = "*****@*****.**", Club = RandoxIT, Rating = 70
                };
                Members.Add(Oran);
                var Darren = new Member()
                {
                    FirstName = "Darren", LastName = "Tweed", Email = "*****@*****.**", Club = RandoxIT, Rating = 63
                };
                Members.Add(Darren);
                var Mark = new Member()
                {
                    FirstName = "Mark", LastName = "Latten", Email = "*****@*****.**", Club = RandoxIT, Rating = 64
                };
                Members.Add(Mark);
                var MarkTwo = new Member()
                {
                    FirstName = "Mark", LastName = "Lutton", Email = "*****@*****.**", Club = RandoxIT, Rating = 64
                };
                Members.Add(MarkTwo);
                var Ivan = new Member()
                {
                    FirstName = "Ivan", LastName = "Mc", Email = "*****@*****.**", Club = RandoxIT, Rating = 68
                };
                Members.Add(Ivan);
                var Kelso = new Member()
                {
                    FirstName = "Steven", LastName = "Kelso", Email = "*****@*****.**", Club = RandoxIT, Rating = 71
                };
                Members.Add(Kelso);
                var Frazer = new Member()
                {
                    FirstName = "Andrew", LastName = "Frazer", Email = "*****@*****.**", Club = RandoxIT, Rating = 72
                };
                Members.Add(Frazer);
                var Cormac = new Member()
                {
                    FirstName = "Cormac", LastName = "Byrne", Email = "*****@*****.**", Club = RandoxIT, Rating = 66
                };
                Members.Add(Cormac);
                var JJ = new Member()
                {
                    FirstName = "JJ", LastName = "Eng", Email = "*****@*****.**", Club = RandoxIT, Rating = 61
                };
                Members.Add(JJ);
                var Dean = new Member()
                {
                    FirstName = "Dean", LastName = "Mc", Email = "*****@*****.**", Club = RandoxIT, Rating = 45.6, Active = false
                };
                Members.Add(Dean);
                var Ryan = new Member()
                {
                    FirstName = "Ryan", LastName = "Gavin", Email = "*****@*****.**", Club = RandoxIT, Rating = 86.1, Active = false
                };
                Members.Add(Ryan);
                var Iniaki = new Member()
                {
                    FirstName = "Iniaki", LastName = "McKearny", Email = "*****@*****.**", Club = RandoxIT, Rating = 75.0, Active = false
                };
                Members.Add(Iniaki);
                var JamesD = new Member()
                {
                    FirstName = "James", LastName = "Davidson", Email = "*****@*****.**", Club = RandoxIT, Rating = 59.0, Active = false
                };
                Members.Add(JamesD);
                var StuartG = new Member()
                {
                    FirstName = "Stuart", LastName = "Gray", Email = "*****@*****.**", Club = RandoxIT, Rating = 87.0, Active = false
                };
                Members.Add(StuartG);
                var William = new Member()
                {
                    FirstName = "William", LastName = "Lawrence", Email = "*****@*****.**", Club = RandoxIT, Rating = 79.0, Active = false
                };
                Members.Add(William);
                var Pierce = new Member()
                {
                    FirstName = "Pierce", LastName = "Slaney", Email = "*****@*****.**", Club = RandoxIT, Rating = 62.0, Active = false
                };
                Members.Add(Pierce);
                var Michael = new Member()
                {
                    FirstName = "Michael", LastName = "Crampsey", Email = "*****@*****.**", Club = RandoxIT, Rating = 50.0, Active = false
                };
                Members.Add(Michael);
                RandoxIT.Members = Members;
                context.Clubs.Add(RandoxIT);

                var RandoxEng = new Club()
                {
                    Name = "Rdox Engineering"
                };
                CreateMemberList(RandoxEng);
                context.Clubs.Add(RandoxEng);

                for (int i = 2; i <= 105; i++)
                {
                    var club = new Club()
                    {
                        Name = $"Club {i}"
                    };
                    CreateMemberList(club);
                    context.Clubs.Add(club);
                }

                await context.SaveChangesAsync();
            }
        }
예제 #20
0
 public static async Task SeedAsync(ClubsContext context)
 {
     await SeedClubsAndMembers(context);
     await SeedLocations(context);
 }
예제 #21
0
 public LoginController(ClubsContext dbContext)
 {
     _dbContext = dbContext;
 }
        //SEEDING CLUBS
        private void SeedClubs(ClubsContext context)
        {
            //adding Clubs
            #region AddClubs

            #region AddChessClub
            context.Clubs.AddOrUpdate(club => club.CreationDate, new Club[] {
                new Club
                {
                    ClubName     = "The Chess Club",
                    CreationDate = DateTime.Parse("25/01/2017"),
                    clubEvents   = new List <ClubEvent>()
                    {
                        //start the event AFTER the club was created, pass 5 days, 15:00 hours
                        new ClubEvent {
                            StartDateTime = DateTime.Parse("25/01/2017").Add(new TimeSpan(6, 17, 0, 0, 0)),
                            //end the event one hour after you previously set the event start time
                            EndDateTime = DateTime.Parse("25/01/2017").Add(new TimeSpan(6, 21, 0, 0, 0)),
                            Location    = "IT Sligo", Venue = "D1030"
                        },
                        new ClubEvent {
                            StartDateTime = DateTime.Parse("25/01/2017").AddMonths(2).Add(new TimeSpan(0, 13, 0, 0, 0)),
                            EndDateTime   = DateTime.Parse("25/01/2017").AddMonths(2).Add(new TimeSpan(0, 14, 0, 0, 0)),
                            Location      = "IT Sligo", Venue = "D1031"
                        },
                    }                    // End of new CLub events
                },                       // End of First club added other clubs can be added next
            }                            // End of Clubs array
                                      ); // End of Add or Update
            #endregion AddChessClub

            #region AddVolleyBallClub

            context.Clubs.AddOrUpdate(club => club.CreationDate, new Club[] {
                new Club
                {
                    ClubName     = "Volley Ball Club",
                    CreationDate = DateTime.Parse("01/01/2018"),
                    clubEvents   = new List <ClubEvent>()
                    {
                        //start the event AFTER the club was created, pass 5 days, 15:00 hours
                        new ClubEvent {
                            StartDateTime = DateTime.Parse("01/01/2018").AddMonths(1).Add(new TimeSpan(15, 14, 0, 0, 0)),
                            //end the event one hour after you previously set the event start time
                            EndDateTime = DateTime.Parse("01/01/2018").AddMonths(1).Add(new TimeSpan(15, 16, 0, 0, 0)),
                            Location    = "IT Sligo", Venue = "Sports Arena"
                        },
                        new ClubEvent {
                            StartDateTime = DateTime.Parse("01/01/2018").AddMonths(1).Add(new TimeSpan(25, 16, 0, 0, 0)),
                            EndDateTime   = DateTime.Parse("01/01/2018").AddMonths(1).Add(new TimeSpan(25, 19, 0, 0, 0)),
                            Location      = "Regional Sports Center", Venue = "Main Hall"
                        },
                    }                    // End of new CLub events
                },                       // End of First club added other clubs can be added next
            }                            // End of Clubs array
                                      ); // End of Add or Update
            #endregion AddVolleyBallClub

            #region AddSoccerClub
            context.Clubs.AddOrUpdate(club => club.CreationDate, new Club[] {
                new Club
                {
                    ClubName     = "Soccer Club",
                    CreationDate = DateTime.Parse("07/01/2018"),
                    clubEvents   = new List <ClubEvent>()
                    {
                        //start the event AFTER the club was created, pass 5 days, 15:00 hours
                        new ClubEvent {
                            StartDateTime = DateTime.Parse("07/01/2018").AddMonths(10).Add(new TimeSpan(10, 15, 0, 0, 0)),
                            //end the event one hour after you previously set the event start time
                            EndDateTime = DateTime.Parse("07/01/2018").AddMonths(10).Add(new TimeSpan(10, 21, 0, 0, 0)),
                            Location    = "IT Sligo", Venue = "Main Pitch"
                        },
                        new ClubEvent {
                            StartDateTime = DateTime.Parse("07/01/2018").AddMonths(11).Add(new TimeSpan(5, 18, 0, 0, 0)),
                            EndDateTime   = DateTime.Parse("07/01/2018").AddMonths(11).Add(new TimeSpan(5, 19, 0, 0, 0)),
                            Location      = "Regional Sports Center", Venue = "Astro Pitch"
                        },
                    }                    // End of new CLub events
                },                       // End of First club added other clubs can be added next
            }                            // End of Clubs array
                                      ); // End of Add or Update
            #endregion AddSoccerClub
            #endregion AddClubs
        }
예제 #23
0
 public InvitationMatchCreator(ILogger <IMatchCreator> logger, ClubsContext context, IMapper mapper
                               , IMediator mediator, IMessagePublisher messagePublisher) : base(logger, context, mapper)
 {
     _Mediator         = mediator;
     _MessagePublisher = messagePublisher;
 }
 public ClubsController(ClubsContext context)
 {
     _context = context;
 }
예제 #25
0
 /// <summary>
 /// constructor for OLStyleController to initialize the controller
 /// </summary>
 /// <param name="context">provided to the controller by Dependency Injection in Startup.cs</param>
 public OLStyleController(ClubsContext context)
 {
     _context = context;
 }
예제 #26
0
 public ReservationsController(ClubsContext context)
 {
     _context = context;
 }
예제 #27
0
 public GetClubMembersQueryHandler(ClubsContext context, IMapper mapper)
 {
     _Context = context;
     _Mapper  = mapper;
 }
예제 #28
0
 public NPInstrumentsController(ClubsContext context)
 {
     _context = context;
 }
예제 #29
0
 public UpdateClubCommandHandler(ClubsContext context, IMapper mapper)
 {
     _Context = context;
     _Mapper  = mapper;
 }
예제 #30
0
 public GetMatchesForClubQueryHandler(ClubsContext context, IMapper mapper)
 {
     _Context = context;
     _Mapper  = mapper;
 }