Esempio n. 1
0
 public void EditRace(RaceDetailsViewModel model)
 {
     using (var unit = new UnitOfWork())
     {
         var loadParticipants = unit.Participant.LoadParticipants(new ParticipantFilter { RaceId = model.RaceId });
         foreach (var participantViewModel in model.Participants)
         {
             var viewModel = participantViewModel;
             foreach (var participant in loadParticipants.Where(participant => viewModel.ParticipantId == participant.Id))
             {
                 participant.NumberInRace = participantViewModel.NumberInRace;
                 participant.PlaceInRace = participantViewModel.PlaceInRace;
                 unit.Participant.Save(participant);
                 break;
             }
         }
     }
 }
Esempio n. 2
0
 private RaceDetailsViewModel getRaceDetailsViewModelWithoutParticipants(Race race)
 {
     var model = new RaceDetailsViewModel
     {
         RaceId = race.Id,
         DateTimeOfRace = race.DateTimeOfRace.ToShortDateString(),
         NumberRaceInDay = race.NumberRaceInDay.ToString(CultureInfo.InvariantCulture)
     };
     return model;
 }