Ejemplo n.º 1
0
 public void Delete(StrengthTrainingItemViewModel strengthTrainingItemViewModel)
 {
     Entry.Entries.Remove(strengthTrainingItemViewModel.Item);
     _exercises.Remove(strengthTrainingItemViewModel);
     //now reset Position
     ResetPositions(Entry);
 }
Ejemplo n.º 2
0
        public StrengthTrainingItemViewModel AddExercise(ExerciseLightDTO exercise)
        {
            StrengthTrainingItemDTO item = new StrengthTrainingItemDTO();

            item.Exercise = exercise;
            Entry.Entries.Add(item);
            item.Position = Entry.Entries.Count;
            item.StrengthTrainingEntry = Entry;
            StrengthTrainingItemViewModel itemViewModel = new StrengthTrainingItemViewModel(item);

            _exercises.Add(itemViewModel);
            return(itemViewModel);
        }
Ejemplo n.º 3
0
        public void RemoveSuperSet(StrengthTrainingItemViewModel item)
        {
            string supersetGroup = item.Item.SuperSetGroup;

            item.RemoveSuperSet();
            List <StrengthTrainingItemViewModel> itemsInGroup = new List <StrengthTrainingItemViewModel>();

            foreach (var itemViewModel in _exercises)
            {
                if (itemViewModel.Item.SuperSetGroup == supersetGroup)
                {
                    itemsInGroup.Add(itemViewModel);
                }
            }
            if (itemsInGroup.Count == 1)
            {//there is only one exercise in the group so we can remove the group
                itemsInGroup[0].RemoveSuperSet();
            }
        }