public async Task <IActionResult> Edit(EditExerciseTemplatesViewModel editExerciseTemplatesViewModel) { if (ModelState.IsValid) { var exercise = await _exercisesRepository.GetByIdAsync(editExerciseTemplatesViewModel.Id); if (exercise == null) { return(NotFound()); } exercise.Update(editExerciseTemplatesViewModel.Description, editExerciseTemplatesViewModel.TestTemplateId, false); await _exercisesRepository.UpdateAsync(exercise); return(RedirectToAction(nameof(Edit), "TestTemplates", new { id = editExerciseTemplatesViewModel.TestTemplateId })); } return(View(editExerciseTemplatesViewModel)); }