コード例 #1
0
        public ActionResult Create(match match)
        {
            if (ModelState.IsValid)
            {
                var dao = new match_dao();

                string errorMessage = "";
                var    result       = dao.Insert(ref errorMessage, match);

                if (result == 1)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "Match", new { season_id = match.season_id, round_id = match.round_id }));
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", errorMessage);
                }
                else if (result == -3)
                {
                    ModelState.AddModelError("", errorMessage);
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertMatchFailed);
                }
            }
            SetListClub(match.home_club, match.guest_club, match.season_id);
            SetListRound(match.round_id);
            SetListSeason(match.season_id);
            return(View());
        }
コード例 #2
0
        public ActionResult Edit(int id)
        {
            var model = new match_dao().Get_By_Id(id);

            SetListClub(model.home_club, model.guest_club, model.season_id);
            SetListRound(model.round_id);
            SetListSeason(model.season_id);
            return(View(model));
        }
コード例 #3
0
 public ActionResult DeleteAllChecked(string ids)
 {
     if (ids != "" && ids != null)
     {
         string[] array_id = ids.Split(',');
         var      dao      = new match_dao();
         foreach (var id in array_id)
         {
             dao.Delete(int.Parse(id));
         }
     }
     return(RedirectToAction("Index"));
 }
コード例 #4
0
        public ActionResult Index(int page = 1, int page_size = 15, string season_id = null, string round_id = null)
        {
            var dao   = new match_dao();
            var model = dao.ListMatch_BySeasonRound(ref season_id, ref round_id, page, page_size);

            SetListSeason(season_id);
            SetListRound(round_id, season_id);

            ViewBag.currentSeasonID = season_id;
            ViewBag.currentRoundID  = round_id;

            return(View(model));
        }
コード例 #5
0
        public ActionResult Detail(int match_id)
        {
            var match_dao = new match_dao();
            var model     = match_dao.Get_By_Id(match_id);

            ViewBag.ListGoal    = new match_goal_dao().ListGoal_ByMatchID(match_id);
            ViewBag.TopViewPost = new content_dao().ListTopViewContent_By_Category(0, 3);
            ViewBag.MatchName   = match_dao.GetMatchName_ByMatchID(match_id);

            //advertisement
            var ad_dao = new ads_dao();

            ViewBag.Advertisement_300x250 = ad_dao.GetAdvertisement_By_Type("300x250");

            return(View(model));
        }
コード例 #6
0
        public ActionResult Create(int match_id = 0)
        {
            //Check Match in Season
            //Default value = 0 if not exits
            var match_dao    = new match_dao();
            var result_macth = match_dao.CheckMatch(match_id);

            match_id = result_macth == true ? match_id : 0;

            ViewBag.MatchName      = match_dao.GetMatchName_ByMatchID(match_id);
            ViewBag.CurrentMatchID = match_id;

            //Setting list for dropdownlist
            SetListGoalType();
            SetListFootballer(match_id);
            return(View());
        }
コード例 #7
0
        public ActionResult Index(int page = 1, int page_size = 15, string season_id = null, string round_id = null)
        {
            var match_dao = new match_dao();
            var rank_dao  = new rank_dao();

            SetListSeason(season_id);
            SetListRound(round_id, season_id);

            //Lấy thứ tự ưu tiên sắp xếp BXH
            string sort_type1 = "", sort_type2 = "", sort_type3 = "", sort_type4 = "";

            new general_rule_dao().GetSortRule(ref sort_type1, ref sort_type2, ref sort_type3, ref sort_type4);

            ViewBag.Match           = match_dao.ListMatch_BySeasonRound(ref season_id, ref round_id, page, page_size);
            ViewBag.RankSeason      = rank_dao.ListClubRank_BySeason(ref season_id, sort_type1, sort_type2, sort_type3, sort_type4);
            ViewBag.currentSeasonID = season_id;
            ViewBag.currentRoundID  = round_id;

            return(View());
        }
コード例 #8
0
        public ActionResult Edit(match match)
        {
            if (ModelState.IsValid)
            {
                var dao    = new match_dao();
                var result = dao.Update(match);

                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "Match", new { season_id = match.season_id, round_id = match.round_id }));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateMatchFailed);
                }
            }
            SetListClub(match.home_club, match.guest_club, match.season_id);
            SetListRound(match.round_id);
            SetListSeason(match.season_id);
            return(View());
        }
コード例 #9
0
        public ActionResult Edit(int id)
        {
            var result_macth = false;

            var model = new match_goal_dao().Get_By_Id(id);

            //Check Match in Season
            //Default value = 0 if not exits
            var match_dao = new match_dao();

            if (model != null)
            {
                result_macth = match_dao.CheckMatch(model.match_id);
                SetListGoalType(model.goal_type_id);
                SetListFootballer(model.match_id, model.footballer_id);
            }
            var match_id = result_macth == true ? model.match_id : 0;

            ViewBag.MatchName      = match_dao.GetMatchName_ByMatchID(match_id);
            ViewBag.CurrentMatchID = match_id;
            return(View(model));
        }