예제 #1
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context      = context;
     Plans         = new PlanRepository(context);
     Workouts      = new WorkoutRepository(context);
     Exercises     = new ExerciseRepository(context);
     Favourites    = new FavouriteRepository(context);
     Genres        = new GenreRepository(context);
     Ratings       = new RatingRepository(context);
     TrainingTypes = new TrainingTypeRepository(context);
     Users         = new UserRepository(context);
     Views         = new ViewRepository(context);
 }
예제 #2
0
        public TrainingType CreateTrainingType()
        {
            ITrainingTypeRepository trainingTypeRepo = new TrainingTypeRepository(db);
            var trainingType = new TrainingType();
            var TypeOne      = new TrainingType {
                Id = 1, Name = " ", Description = " ", DurationInMinutes = 12
            };
            var TypeTwo = new TrainingType {
                Id = 2, Name = " ", Description = " ", DurationInMinutes = 13
            };
            var TypeThree = new TrainingType {
                Id = 3, Name = " ", Description = " ", DurationInMinutes = 21
            };

            trainingTypeRepo.Add(TypeOne);
            trainingTypeRepo.Add(TypeTwo);
            trainingTypeRepo.Add(TypeThree);

            return(trainingType);
        }