Пример #1
0
        public void AddMatch_Saves_Match()
        {
            Match match = new Match()
            {
                HostTeam  = host,
                HostId    = 1,
                GuestTeam = guest,
                GuestId   = 2
            };

            matchService.AddMatch(match);

            matchSet.Verify(m => m.Add(It.IsAny <Match>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
Пример #2
0
        public ActionResult AddMatch(EditTourViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("EditTour", new { tourId = viewModel.TourDto.TourId }));
            }

            var match = new Match(
                viewModel.InputDate,
                viewModel.SelectedHomeTeamId,
                viewModel.SelectedAwayTeamId,
                viewModel.TourDto.TourId);

            _matchService.AddMatch(match);
            return(RedirectToAction("EditTour", new { tourId = viewModel.TourDto.TourId }));
        }
Пример #3
0
        private void AddMatch(object parameter)
        {
            if (!ValidateParams(parameter))
            {
                ShowInfoWindow("Podaj poprawne dane");
                return;
            }
            var values = (object[])parameter;

            StadiumViewModel stadionName      = (StadiumViewModel)values[0];
            ClubViewModel    hostName         = (ClubViewModel)values[1];
            ClubViewModel    guestName        = (ClubViewModel)values[2];
            ReffereViewModel mainReffere      = (ReffereViewModel)values[3];
            ReffereViewModel technicalReffere = (ReffereViewModel)values[4];
            ReffereViewModel linearReffere    = (ReffereViewModel)values[5];
            ReffereViewModel observerReffere  = (ReffereViewModel)values[6];
            int hostGoals  = Int32.Parse((string)values[7].ToString());
            int guestGoals = Int32.Parse((string)values[8].ToString());

            matchService.AddMatch(stadionName.ID, hostName.ID, guestName.ID, mainReffere.ID, technicalReffere.ID, linearReffere.ID, observerReffere.ID, hostGoals, guestGoals);
            UpdateMatchGrid();
        }