Ejemplo n.º 1
0
        public ActionResult Details(
            int idstadium, DateTime date, int idfirstref,
                int idsecondref, int idthirdref, int idfourref,
                int idvisitor, DateTime datevisitor, int idagainst, DateTime dateagainst
            )
        {
            MatchModel matchModel = new MatchModel()
            {
                Date = date,
                IdStadium = idstadium,
                IdFirstReferee = idfirstref,
                IdSecondReferee = idsecondref,
                IdThirdReferee = idthirdref,
                IdFourReferee = idfourref,
                IdVisitor = idvisitor,
                DateVisitor = datevisitor,
                IdAgainst = idagainst,
                DateAgainst = dateagainst
            };
            ClubModel visitor = _mapperClubToClubModel.Map(_repo.GetClub(idvisitor));
            ClubModel against = _mapperClubToClubModel.Map(_repo.GetClub(idagainst));

            GameDetails details = new GameDetails()
            {
                matchModel = matchModel,
                clubvisitor = visitor,
                clubagainst = against
            };

            return View(details);
        }
Ejemplo n.º 2
0
        public ActionResult Create(String selectedhome, String selectedaway, String selectedstadium,
            String selectedrefereefirst, String selectedrefereesecond, String selectedrefereethird, String selectedrefereefour)
        {
            string[] hometeam = selectedhome.Split('|');
            string[] awayteam = selectedaway.Split('|');

            MatchModel matchModel = new MatchModel()
            {
                Date = DateTime.Now,
                IdStadium = Convert.ToInt32(selectedstadium),
                IdFirstReferee = Convert.ToInt32(selectedrefereefirst),
                IdSecondReferee = Convert.ToInt32(selectedrefereesecond),
                IdThirdReferee = Convert.ToInt32(selectedrefereethird),
                IdFourReferee = Convert.ToInt32(selectedrefereefour),
                IdVisitor = Convert.ToInt32(hometeam[0]),
                DateVisitor = Convert.ToDateTime(hometeam[1]),
                IdAgainst = Convert.ToInt32(awayteam[0]),
                DateAgainst = Convert.ToDateTime(awayteam[1])
            };

            _repo.CreateMatch(_mapperMatchModelToMatch.Map(matchModel));

            return RedirectToAction("Index");
        }