public ScheduledTestsController(ITestInstancesRepository testInstancesRepository, IMapper mapper, IUserContext userContext, IGroupsRepository groupsRepository, ITestsRepository testsRepository, IAnswersRepository answersRepository, IExercisesRepository exercisesRepository, ITestTypesRepository testTypesRepository) { _testInstancesRepository = testInstancesRepository; _mapper = mapper; _groupsRepository = groupsRepository; _testsRepository = testsRepository; _answersRepository = answersRepository; _exercisesRepository = exercisesRepository; _testTypesRepository = testTypesRepository; var userId = userContext.GetLogedInUserId(); if (userId == null) { throw new ApplicationException("userId is null"); } _userId = (Guid)userId; }
public ExerciseTemplatesController(IExercisesRepository exercisesRepository, IMapper mapper, IAnswersRepository answersRepository) { _exercisesRepository = exercisesRepository; _mapper = mapper; _answersRepository = answersRepository; }
public AnalysisTabbedPage(IComponentContext componentContext, IMessagingService messagingService, IScreenSizeHandler screenSizeHandler, IWorkoutsRepository workoutsRepository, IExercisesRepository exercisesRepository) { InitializeComponent(); _componentContext = componentContext; _messagingService = messagingService; _screenSizeHandler = screenSizeHandler; _workoutsRepository = workoutsRepository; _exercisesRepository = exercisesRepository; Title = AppResources.AnalysisTitle; }
public CreateAnswerTemplatesValidator(ITestsRepository tests, IExercisesRepository exercises, IUserContext user) { RuleFor(x => x.Description).NotEmpty().WithMessage(string.Format(CoreConfigurationConstants.FieldEmptyMessage, "Description")) .MaximumLength(CoreConfigurationConstants.MaxLength) .WithMessage(string.Format(CoreConfigurationConstants.FieldMaximumLengthMessage, "Description", CoreConfigurationConstants.MaxLength)); _exerciseRepository = exercises; List <Test> TestId = new List <Test>(); RuleFor(x => x.TestTemplateId) .NotEmpty().WithMessage(string.Format(CoreConfigurationConstants.FieldEmptyMessage, "Test Template Id")) .Custom((x, context) => { var testsList = tests.GetAllAsync().Result.Where(a => a.Id == x).ToList(); if (testsList.Count == 0) { context.AddFailure("Test Template Id", "Test Template Id is not valid"); } else { if (user.GetLogedInUserId() != testsList[0].UserId) { context.AddFailure("Test Template Id", "Unauthorized"); } } TestId = testsList; }); RuleFor(x => x.ExerciseTemplateId) .NotEmpty().WithMessage(string.Format(CoreConfigurationConstants.FieldEmptyMessage, "Exercise Template Id")) .Custom((x, context) => { var exercisesList = exercises.GetAllAsync().Result.Where(a => a.Id == x).ToList(); if (exercisesList.Count == 0) { context.AddFailure("Exercise Template Id", "Exercise Template Idis not valid"); } else { if (TestId[0].Id != exercisesList[0].TestId) { context.AddFailure("Exercise Template Id", "Unauthorized"); } } }); }
public ExerciseDetailsViewModel( IMasterDetailNavigation navigationService, IDialogService dialogService, IMessagingService messagingService, IUnitsService units, IExercisesRepository exercisesRepository, IRoutineDaysRepository routineDaysRepository) { _navigationService = navigationService; _dialogService = dialogService; _messagingService = messagingService; _units = units; _exercisesRepository = exercisesRepository; _routineDaysRepository = routineDaysRepository; Title = AppResources.AddExerciseTitle; DeleteCommand = new Command(async() => { await OnDelete(); }); SaveCommand = new Command(async() => await OnSave()); }
public TestTemplatesController(ITestsRepository testsRepository, IMapper mapper, IUserContext userContext, ITestTypesRepository testTypesRepository, IExercisesRepository exercisesRepository) { _testsRepository = testsRepository; _mapper = mapper; _testTypesRepository = testTypesRepository; _exercisesRepository = exercisesRepository; var userId = userContext.GetLogedInUserId(); if (userId == null) { throw new ApplicationException("userId is null"); } _userId = (Guid)userId; }
public ExerciseListViewModel(IMasterDetailNavigation navigationService, IMessagingService messagingService, IExercisesRepository exercisesRepository) { _navigationService = navigationService; _messagingService = messagingService; _exercisesRepository = exercisesRepository; Title = AppResources.ExercisesTitle; SelectItemCommand = new Command(async(item) => { await OnItemSelected(item); }); AddExerciseCommand = new Command(async() => { await _navigationService.NavigateToHierarchical <ExerciseDetailsViewModel>(); }); _messagingService.Subscribe <ExerciseDetailsViewModel, Exercise>(this, Messages.ItemAdded, async(sender, e) => { var item = new ExerciseItem { Exercise = e, TrainingDays = await _exercisesRepository.GetTrainingDays(e) }; Exercises.Add(item); UpdateVisible(); }); _messagingService.Subscribe <ExerciseDetailsViewModel, Exercise>(this, Messages.ItemChanged, async(sender, e) => { var item = Exercises.FirstOrDefault(x => x.Exercise.ExerciseId == e.ExerciseId); if (item == null) { return; } item.Exercise = null; item.Exercise = e; item.TrainingDays = await _exercisesRepository.GetTrainingDays(e); }); _messagingService.Subscribe <ExerciseDetailsViewModel>(this, Messages.ItemDeleted, sender => { var item = Exercises.FirstOrDefault(x => x.Exercise.ExerciseId == sender.ExerciseId); Exercises.Remove(item); UpdateVisible(); }); }
public DbSeeder( DatabaseContext databaseContext, IServiceProvider serviceProvider, RoleManager <Role> roleManager, UserManager <User> userManager, IGroupsRepository groupsRepository, ITestTypesRepository testTypesRepository, IUsersRepository usersRepository, ITestsRepository testsRepository, IExercisesRepository exercisesRepository, IAnswersRepository answersRepository) { _databaseContext = databaseContext; _serviceProvider = serviceProvider; _roleManager = roleManager; _userManager = userManager; _groupsRepository = groupsRepository; _testTypesRepository = testTypesRepository; _usersRepository = usersRepository; _testsRepository = testsRepository; _exercisesRepository = exercisesRepository; _answersRepository = answersRepository; }
public ExercisesService(IActivationsRepository activationsRepository, IExercisesRepository exercisesRepository) { _activationsRepository = activationsRepository; _exercisesRepository = exercisesRepository; }
public ExercisesService(IExercisesRepository exercisesRepository) { ExercisesRepository = exercisesRepository; }
public ExercisesController(IExercisesRepository exercisesRepository, IMapper mapper) { _exercisesRepository = exercisesRepository; _mapper = mapper; }
public ExerciseLogic() { HomeworksContext context = ContextFactory.GetNewContext(); exerciseRepository = new ExercisesRepository(context); }
public ExercisesController(IMapper mapper, IExercisesRepository repository, IUnitOfWork unitOfWork) { this.mapper = mapper; this.repository = repository; this.unitOfWork = unitOfWork; }
public Exporter(IExercisesRepository exercisesRepository, IWorkoutsRepository workoutsRepository, ITextStorage textStorage) { _exercisesRepository = exercisesRepository; _workoutsRepository = workoutsRepository; _textStorage = textStorage; }
public ExerciseLogic(IExercisesRepository exerciseRepository) { this.exerciseRepository = exerciseRepository; }
public WorkoutsViewModel( IComponentContext componentContext, IMasterDetailNavigation navigationService, IMessagingService messagingService, IDatePickerDialog datePickerDialog, IWorkoutRules workoutRules, IWorkoutsRepository workoutsRepository, IExercisesRepository exercisesRepository, ICalendarRepository calendarRepository, IRoutineDaysRepository routineDaysRepository) { _componentContext = componentContext; _navigationService = navigationService; _messagingService = messagingService; _datePickerDialog = datePickerDialog; _workoutRules = workoutRules; _workoutsRepository = workoutsRepository; _exercisesRepository = exercisesRepository; _calendarRepository = calendarRepository; _routineDaysRepository = routineDaysRepository; RestTimerItem = _componentContext.Resolve <RestTimerItem>(); Title = "One Set To Failure"; ChevronTapCommand = new Command(async(s) => { await OnChevronTapCommand(s); }); CalendarNotesCommand = new Command(async() => { await OnCalendarNotesCommand(); }); GotoDateCommand = new Command(OnGotoDateCommand); SelectItemCommand = new Command(async(item) => { await OnItemSelected(item); }); TimerCommand = new Command(async() => { var parameters = new NavigationParameters { { "RestTimerItem", RestTimerItem } }; await _navigationService.NavigateToHierarchical <RestTimerViewModel>(parameters); }); _messagingService.Subscribe <WorkoutDetailsViewModel, Workout>(this, Messages.ItemChanged, (sender, workout) => { var item = Routine.FirstOrDefault(x => x.Exercise.ExerciseId == workout.ExerciseId); if (item == null) { return; } item.Workout = null; item.Workout = workout; }); _messagingService.Subscribe <ExerciseDetailsViewModel, Exercise>(this, Messages.ItemAdded, async(sender, e) => { await Reload(); }); _messagingService.Subscribe <ExerciseDetailsViewModel, Exercise>(this, Messages.ItemChanged, async(sender, e) => { await Reload(); }); _messagingService.Subscribe <ExerciseDetailsViewModel>(this, Messages.ItemDeleted, async sender => { await Reload(); }); _messagingService.Subscribe <CalendarNotesViewModel>(this, Messages.ItemChanged, async sender => { await LoadNotes(); }); _messagingService.Subscribe <SettingsViewModel>(this, Messages.WorkoutDataCleared, async sender => { await Reload(); }); }
public ExercisesController(IExercisesRepository repo, IMapper mapper) { _repo = repo; _mapper = mapper; }