コード例 #1
0
 public GradesController(Data.StudentDbContext _studentContext, Data.ResourceDbContext _resourceDbContext,
                         IAuthorizationService _authService)
 {
     studentDbContext  = _studentContext;
     resourceDbContext = _resourceDbContext;
     authService       = _authService;
 }
コード例 #2
0
ファイル: ClassController.cs プロジェクト: K-Karol/Swimclub
 public ClassController(Data.StudentDbContext _studentContext, Data.ResourceDbContext _resourceDbContext, Data.UserDbContext _userDb,
                        IAuthorizationService _authService)
 {
     studentDbContext  = _studentContext;
     resourceDbContext = _resourceDbContext;
     userDbContext     = _userDb;
     authService       = _authService;
 }
コード例 #3
0
ファイル: SeedData.cs プロジェクト: K-Karol/Swimclub
        private static async Task AddTestGrades(Data.ResourceDbContext _context)
        {
            if (_context.Grades.Any())
            {
                return;
            }

            _context.Grades.Add(new Entities.Grade()
            {
                Number = 1,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });
            _context.Grades.Add(new Entities.Grade()
            {
                Number = 2,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });
            _context.Grades.Add(new Entities.Grade()
            {
                Number = 3,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });
            _context.Grades.Add(new Entities.Grade()
            {
                Number = 4,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });
            _context.Grades.Add(new Entities.Grade()
            {
                Number = 5,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });
            _context.Grades.Add(new Entities.Grade()
            {
                Number = 6,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });
            _context.Grades.Add(new Entities.Grade()
            {
                Number = 7,
                Tests  = new Models.Test[] { new Models.Test()
                                             {
                                                 Number = 1, Name = "Swim 5m"
                                             }, new Models.Test()
                                             {
                                                 Number = 2, Name = "Swim 10m"
                                             }, new Models.Test()
                                             {
                                                 Number = 3, Name = "Swim 15m"
                                             } }
            });

            await _context.SaveChangesAsync();
        }