public IActionResult Create(Guid testTemplateId) { var createExeciseTemplatesViewModel = new CreateExerciseTemplatesViewModel { TestTemplateId = testTemplateId }; return(View(createExeciseTemplatesViewModel)); }
public async Task <IActionResult> Create(CreateExerciseTemplatesViewModel createExerciseTemplatesViewModel) { if (ModelState.IsValid) { var exercise = Exercise.Create(createExerciseTemplatesViewModel.Description, createExerciseTemplatesViewModel.TestTemplateId); var insertedExercise = await _exercisesRepository.InsertAsync(exercise); return(RedirectToAction(nameof(Create), "AnswerTemplates", new { testTemplateId = createExerciseTemplatesViewModel.TestTemplateId, exerciseTemplateId = insertedExercise.Id })); } return(View(createExerciseTemplatesViewModel)); }