示例#1
0
        /// <summary>
        /// 添加或编辑视频
        /// </summary>
        /// <returns></returns>
        public ActionResult Add()
        {
            int id    = CECRequest.GetQueryInt("id", 0);
            var model = VideoService.GetById(id);

            //初始化栏目类别
            var catList = VideoCatService.List().ToList();

            ViewBag.CatList = catList;

            return(View(model));
        }
示例#2
0
        public ActionResult List()
        {
            var list = VideoCatService.List();

            ViewBag.List = list;
            int          id    = Controleng.Common.CECRequest.GetQueryInt("id", 0);
            VideoCatInfo model = null;

            if (id > 0)
            {
                model = VideoCatService.GetById(id);
            }
            return(View(model));
        }
示例#3
0
        public ActionResult List(VideoCatInfo model)
        {
            var list = VideoCatService.List();

            if (ModelState.IsValid)
            {
                VideoCatService.Create(model);
                ViewBag.Msg = "保存成功";
            }

            list         = VideoCatService.List();
            ViewBag.List = list;


            return(View());
        }
示例#4
0
        public ActionResult Add(VideoInfo oldModel, FormCollection fc)
        {
            bool isAdd = true;

            if (oldModel.Id > 0)
            {
                isAdd = false;
            }

            //判断标题是否为空
            bool errors = false;

            //所选分类
            oldModel.CategoryId = Utils.StrToInt(fc["select_column"], 0);
            if (oldModel.CategoryId == 0)
            {
                ModelState.AddModelError("CATNOTSELECTED", "请选择视频所属分类");
                errors = true;
            }
            if (string.IsNullOrEmpty(oldModel.Title))
            {
                ModelState.AddModelError("TITLEEMPTY", "标题不能为空");
                errors = true;
            }


            if (!errors && ModelState.IsValid)
            {
                oldModel = VideoService.Create(oldModel);
                //完成,提示信息
                if (isAdd)
                {
                    ViewBag.Msg = "添加成功!<a href=\"add\">继续?</a><span class=\"ml10\">或</span><a href=\"list\" class=\"ml10\">返回</a>";
                }
                else
                {
                    ViewBag.Msg = "修改成功!<a href=\"add\">添加新视频?</a><span class=\"ml10\">或</span><a href=\"list\" class=\"ml10\">返回</a>";
                }
            }
            //初始化栏目类别
            var catList = VideoCatService.List().ToList();

            ViewBag.CatList = catList;

            return(View(oldModel));
        }
示例#5
0
        //
        // GET: /Video/Home/
        /// <summary>
        /// 视频列表
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            int pageIndex = CECRequest.GetQueryInt("page", 1);
            int catId     = CECRequest.GetQueryInt("catid", 0);

            //初始化栏目类别
            var catList = VideoCatService.List().ToList();

            ViewBag.CatList = catList;

            var list = VideoService.List(new VideoSearchSetting()
            {
                PageIndex   = pageIndex,
                CategoryId  = catId,
                ShowDeleted = true
            });

            ViewBag.List = list;
            return(View());
        }