public void DeleteWorkout(DeleteWorkoutCommand command) { var workout = this.context.Workouts .Include(p => p.WorkoutExercises) .ThenInclude(p => p.Sets) .Single(p => p.Id == command.Id); this.context.Remove(workout); this.context.SaveChanges(); }
public async Task <IActionResult> DeleteWorkout([FromBody] DeleteWorkoutRequest request) { var command = new DeleteWorkoutCommand() { WorkoutId = request.WorkoutId }; await this.mediator.Send(command); return(Ok()); }