Exemple #1
0
        public ActionResult Create(match_goal match_goal)
        {
            if (ModelState.IsValid)
            {
                var dao       = new match_goal_dao();
                var info_rule = new general_rule_dao().GetRule();

                var result = dao.Insert(match_goal);
                if (result == 1)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "MatchGoal", new { match_id = match_goal.match_id }));
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", "Thởi điểm ghi bàn không hợp lệ (từ 0 -> " + info_rule.max_time_goal + ")");
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertMatchGoalFailed);
                }
            }
            SetListGoalType(match_goal.goal_type_id);
            SetListFootballer(match_goal.match_id, match_goal.footballer_id);
            ViewBag.CurrentMatchID = match_goal.match_id;
            return(View());
        }
Exemple #2
0
        public ActionResult Index(int page = 1, int page_size = 15, int?match_id = null, string season_id = null)
        {
            var dao   = new match_goal_dao();
            var model = dao.ListMatchGoal_ByMatchSeason(ref match_id, ref season_id, page, page_size);

            //setting list season for dropdownlist
            SetListSeason(season_id);

            ViewBag.Match = match_id;
            return(View(model));
        }
Exemple #3
0
 public ActionResult DeleteAllChecked(string ids)
 {
     if (ids != "" && ids != null)
     {
         string[] array_id = ids.Split(',');
         var      dao      = new match_goal_dao();
         foreach (var id in array_id)
         {
             dao.Delete(int.Parse(id));
         }
     }
     return(RedirectToAction("Index"));
 }
Exemple #4
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));
        }