Exemplo n.º 1
0
        public async Task SaveRepsUnilateral(UnilateralRepsVM convertedData)
        {
            var user = await _accountClient.GetCurrentClient();

            UnilateralExercisesHistoryVM unilateralExercisesHistory = new UnilateralExercisesHistoryVM
            {
                Reps       = convertedData.Reps,
                ExerciseId = convertedData.ExerciseId,
                UserId     = user.UserId
            };

            await _homeClient.SaveRepsUnilateral(unilateralExercisesHistory);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SaveRepsUnilateral(UnilateralRepsVM convertedData)
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            if (user == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            var userVM = new UserVM
            {
                UserId   = user.Id,
                UserName = user.UserName
            };


            History history = new History
            {
                ExerciseId = convertedData.ExerciseId,
                Date       = DateTime.Now,
                UserId     = userVM.UserId
            };

            await _repositoryWrapper.HistoryRepository.CreateAsync(history);

            UnilateralExercisesHistory unilateralHistory = new UnilateralExercisesHistory
            {
                ExerciseId = convertedData.ExerciseId,
                UserId     = userVM.UserId,
                Date       = history.Date,
                Reps       = convertedData.Reps
            };

            await _repositoryWrapper.UnilateralExercisesHistoryRepository.CreateAsync(unilateralHistory);

            return(Ok());
        }