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());
        }