예제 #1
0
        public ActionResult GameEditFun()
        {
            if (!CheckLogin())
            {
                ContentResult cr = new ContentResult();
                cr.ContentType = "text/html";
                cr.Content = "请先登陆<a href='../Admin/Login'>Login</a>";
                return cr;
            }

            //TempData["Info"]
            Manage_T_Game mtg;
            T_Game t_g;
            string strid = Request.Form.Get("id").ToString();
            int id = 0;
            if (Int32.TryParse(strid, out id) && id > 0)  //判断ID是否合法
            {
                mtg = new Manage_T_Game();
                t_g = mtg.GetModelById(id);
                ViewData["GameInfo"] = t_g;

                t_g.F_NumOne = GetInt("txt_num1");
                t_g.F_NumTwo = GetInt("txt_num2");
                t_g.F_NumThree = GetInt("txt_num3");
                t_g.F_Bonus = GetInt("txt_boun");
                t_g.F_InvolvedNum = GetInt("txt_inv");
                t_g.F_WinningNum = GetInt("txt_win");
                int row=mtg.Update(t_g);
                if (row > 0)
                {
                    TempData["Info"] = "Update Success";
                }
                else
                {
                    TempData["Info"] = "Update Row Zero";
                }

            }
            else
            {
                TempData["Info"] = "ID VALUE ERROR";
                return View("GameInfo");
            }
            return View("Index");
        }
예제 #2
0
        /// <summary>
        /// 游戏编辑加载页
        /// </summary>
        /// <returns></returns>
        public ActionResult GameEdit(int? id)
        {
            if (!CheckLogin())
            {
                ContentResult cr = new ContentResult();
                cr.ContentType = "text/html";
                cr.Content = "请先登陆<a href='../Admin/Login'>Login</a>";
                return cr;
            }

            TempData["PageTitle"] = "游戏编辑";

            if (id!=null)
            {
                Manage_T_Game mtg = new Manage_T_Game();
                T_Game tg = mtg.GetModelById(id.Value);
                if (tg == null)
                {
                    throw new Exception("没有获取到模型!!!");
                }
                ViewData["GameInfo"] = tg;
            }
            else
            {
                throw new Exception("没有获取到ID..........");
            }
            return View("GameEdit2");
        }