Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteWorkout([FromBody] DeleteWorkoutRequest request)
        {
            var command = new DeleteWorkoutCommand()
            {
                WorkoutId = request.WorkoutId
            };

            await this.mediator.Send(command);

            return(Ok());
        }