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); }
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()); }