コード例 #1
0
ファイル: DataRepository.cs プロジェクト: jsjf93/Train
        public void DeleteExercise(DeleteExerciseCommand command)
        {
            var exercise = this.context.Exercises
                           .Include(e => e.BodyPartsUsed)
                           .Single(e => e.ExerciseId == command.Id);

            this.context.Exercises.Remove(exercise);
            this.context.SaveChanges();
        }
コード例 #2
0
        public IActionResult DeleteExercise([FromBody] DeleteExerciseCommand command)
        {
            _commandsBus.Send(command);

            return(NoContent());
        }
コード例 #3
0
 public async Task <ActionResult> Delete(
     [FromRoute] DeleteExerciseCommand command)
 => await this.Send(command);