public void CreateWorkoutItem(WorkoutItems workoutItem)
        {
            var exercise = _context.Exercises.Find(workoutItem.Exercise.ExerciseId);

            workoutItem.Exercise = exercise;
            _context.WorkoutItems.Add(workoutItem);
            _context.SaveChanges();
        }
        public void UpdateWorkoutItem(WorkoutItems workoutItem)
        {
            var currentWorkoutItem = _context.WorkoutItems.First(x => x.WorkoutItemId == workoutItem.WorkoutItemId);

            if (currentWorkoutItem != null)
            {
                currentWorkoutItem.Exercise = workoutItem.Exercise;
                currentWorkoutItem.Reps     = workoutItem.Reps;
                currentWorkoutItem.Weight   = workoutItem.Weight;
                currentWorkoutItem.AddDate  = workoutItem.AddDate;
                _context.SaveChanges();
            }
        }
 public void Put([FromBody] WorkoutItems workoutItem)
 {
     _workoutItemService.UpdateWorkoutItem(workoutItem);
 }
 public void Post([FromBody] WorkoutItems workoutItem)
 {
     _workoutItemService.CreateWorkoutItem(workoutItem);
 }