public async Task <IActionResult> Create(ExerciseCreateInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var exerciseId = await this.exercisesService.CreateAsync(input); return(this.RedirectToAction("All")); }
public async Task <string> CreateAsync(ExerciseCreateInputModel input) { var exercise = new Exercise { Name = input.Name, VideoUrl = input.VideoUrl, Difficulty = input.Difficulty, Type = input.Type, }; await this.exerciseRepository.AddAsync(exercise); await this.exerciseRepository.SaveChangesAsync(); return(exercise.Id); }