예제 #1
0
        public ActionResult ComboInfoEdit()
        {
            string c_id = Request["c_id"] ?? string.Empty;
            string c_title = Request["c_title"] ?? string.Empty;
            string c_intro = Request["c_intro"] ?? string.Empty;
            int c_num = Request["c_num"].ToInt32(0);
            int c_days = Request["c_days"].ToInt32(0);
            int c_status = Request["c_status"].ToInt32(0);

            ComboInfo info = null;
            if (string.IsNullOrEmpty(c_id))
            {
                info = new ComboInfo();
                //新增
                string guid = Guid.NewGuid().ToString().Replace("-", "");
                info.c_id = guid;
            }
            else
            {
                info = VideoServiceClass.ComboInfo_SelectByc_id(c_id);
            }

            info.c_title = c_title;
            info.c_intro = c_intro;
            info.c_num = c_num;
            info.c_days = c_days;
            info.c_status = (int)SiteEnum.BasicStatus.有效;


            if (string.IsNullOrEmpty(c_id))
            {
                int result = VideoServiceClass.ComboInfo_Insert(info);
                if (result > 0)
                {
                    return Json(new { success = true, errors = new { text = "新增成功" } });
                }
                else
                {
                    return Json(new { success = false, errors = new { text = "新增失败" } });
                }
            }
            else
            {
                int result = VideoServiceClass.ComboInfo_UpdateById(info);
                if (result > 0)
                {
                    return Json(new { success = true, errors = new { text = "修改成功" } });
                }
                else
                {
                    return Json(new { success = false, errors = new { text = "修改失败" } });
                }
            }
        }