Пример #1
0
        public ActionResult Edit(string id)
        {
            var model = new season_dao().Get_By_Id(id);

            SetListTournament(model.tournamnet_id);
            return(View(model));
        }
Пример #2
0
        public ActionResult Index(int page = 1, int page_size = 15, string season_id = null)
        {
            var dao   = new season_dao();
            var model = new football_club_dao().ListClub_BySeason(ref season_id, page, page_size);

            SetListSeason(season_id);
            ViewBag.currentSeasonID = season_id;

            return(View(model));
        }
Пример #3
0
 public ActionResult DeleteAllChecked(string ids)
 {
     if (ids != "" && ids != null)
     {
         string[] array_id = ids.Split(',');
         var      dao      = new season_dao();
         foreach (var id in array_id)
         {
             dao.Delete(id);
         }
     }
     return(RedirectToAction("Index"));
 }
Пример #4
0
        public ActionResult Edit(season season)
        {
            if (ModelState.IsValid)
            {
                var dao = new season_dao();

                var result = dao.Update(season);
                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "Season"));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateSeasonFailed);
                }
            }
            SetListTournament(season.tournamnet_id);
            return(View());
        }
Пример #5
0
        public ActionResult Create(season season)
        {
            if (ModelState.IsValid)
            {
                var dao = new season_dao();

                int result = dao.Insert(season);
                if (result == 1)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "Season"));
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", "Ngày bắt đầu phải nhỏ hơn ngày kết thúcss");
                }
                else if (result == -1)
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertSeasonFailed);
                }
            }
            SetListTournament(season.tournamnet_id);
            return(View());
        }
        public void SetListSeason(string selected_id = null)
        {
            var dao = new season_dao();

            ViewData["Season"] = new SelectList(dao.ListAll(), "id", "name", selected_id);
        }