Exemple #1
0
        public ChampionshipEntryViewModel(CustomerDTO customer, ChampionshipDTO championship, ChampionshipView mainViewModel)
        {
            this.customer        = customer;
            championshipCustomer = championship.Customers.Where(x => x.CustomerId == customer.GlobalId).SingleOrDefault();
            if (championshipCustomer == null)
            {
                championshipCustomer            = new ChampionshipCustomerDTO();
                championshipCustomer.CustomerId = customer.GlobalId;
                championship.Customers.Add(championshipCustomer);
            }
            var itemGroup = mainViewModel.Groups.Where(x => x.Value == championshipCustomer.Group).SingleOrDefault();

            SelectedGroup = itemGroup;

            var benchPress = ExercisesReposidory.Instance.GetItem(new Guid("ece5dfd7-f995-45ae-bb34-067f26c4f7b4"));
            var przysiad   = ExercisesReposidory.Instance.GetItem(new Guid("3e06a130-b811-4e45-9285-f087403615bf"));
            var deadLift   = ExercisesReposidory.Instance.GetItem(new Guid("505988e1-5663-41f1-aa1a-9b92ea584263"));

            var benchPressEntry = championship.Entries.Where(x => x.Customer.CustomerId == customer.GlobalId && x.Exercise.GlobalId == benchPress.GlobalId).SingleOrDefault();

            if (benchPressEntry == null)
            {
                benchPressEntry          = new ChampionshipEntryDTO();
                benchPressEntry.Exercise = benchPress;
                benchPressEntry.Customer = championshipCustomer;
            }
            var przysiadEntry = championship.Entries.Where(x => x.Customer.CustomerId == customer.GlobalId && x.Exercise.GlobalId == przysiad.GlobalId).SingleOrDefault();

            if (przysiadEntry == null)
            {
                przysiadEntry          = new ChampionshipEntryDTO();
                przysiadEntry.Exercise = przysiad;
                przysiadEntry.Customer = championshipCustomer;
            }

            var deadLiftEntry = championship.Entries.Where(x => x.Customer.CustomerId == customer.GlobalId && x.Exercise.GlobalId == deadLift.GlobalId).SingleOrDefault();

            if (deadLiftEntry == null)
            {
                deadLiftEntry          = new ChampionshipEntryDTO();
                deadLiftEntry.Exercise = deadLift;
                deadLiftEntry.Customer = championshipCustomer;
            }

            exercise1 = new ChampionshipExerciseViewModel(benchPressEntry);
            exercise2 = new ChampionshipExerciseViewModel(przysiadEntry);
            exercise3 = new ChampionshipExerciseViewModel(deadLiftEntry);

            weightCategory = getWeightCategory();
        }
Exemple #2
0
 public ChampionshipExerciseViewModel(ChampionshipEntryDTO entry)
 {
     this.entry = entry;
 }