public async Task SaveRepsBilateral(BilateralRepsVM convertedData) { var user = await _accountClient.GetCurrentClient(); BilateralExercisesHistoryVM bilateralExercisesHistory = new BilateralExercisesHistoryVM { LeftSideReps = convertedData.LeftSideReps, RightSideReps = convertedData.RightSideReps, ExerciseId = convertedData.ExerciseId, UserId = user.UserId }; await _homeClient.SaveRepsBilateral(bilateralExercisesHistory); }
public async Task <IActionResult> SaveRepsBilateral(BilateralRepsVM 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); BilateralExercisesHistory bilateralHistory = new BilateralExercisesHistory { ExerciseId = convertedData.ExerciseId, UserId = userVM.UserId, Date = history.Date, LeftSideReps = convertedData.LeftSideReps, RightSideReps = convertedData.RightSideReps }; await _repositoryWrapper.BilateralExercisesHistoryRepository.CreateAsync(bilateralHistory); return(Ok()); }