Controllers/I2/I0209Controller.cs

(开头部分) 11KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using OPMS.Models;
using System.Text;

namespace OPMS.Controllers
{
    public class I0209Controller : BaseController
    {
        private DBHelp db = new DBHelp();

        //
        // GET: /I0209/
        public ActionResult Index(int id = 0, int ixd = 0, int states=-1, int pageIndex = 1, string queryStr = null)
        {
            ViewBag.SId = id;
            ViewBag.SLx = ixd;//文章类型:分享,问问
            ViewBag.Sx = states;//文章状态
            int pageSize = 20;
            int totalCount = 0;
            List<I0209> Data = new List<I0209>();
            IQueryable<I0209> list = db.I0209;
            if (id != 0)
            {
                //文章类别
                list = list.Where(t => t.Category == id);
            }
            if (ixd != 0)
            {
                //文章类型:分享,问问
                list = list.Where(t => t.Types == ixd);
            }
            if (states != -1)
            {
                //文章状态
                list = list.Where(t => t.States == states);
            }
            if (!string.IsNullOrEmpty(queryStr))
            {
                //关键字查询
                list = list.Where(p => p.Mc.Contains(queryStr) || p.KeyWord.Contains(queryStr) || p.Source.Contains(queryStr));
            }
            totalCount = list.Count();

            //分页排序
            Data = list.OrderBy(t => t.Star).OrderBy(t => t.Addtime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            var pageList = new PagedList<I0209>(Data, pageIndex, pageSize, totalCount);
            ViewBag.queryStr = queryStr;
            return View(pageList);
        }

        public ActionResult Details(int id = 0)
        {
            I0209 i0209 = db.I0209.Find(id);
            if (i0209 == null)
后面还有 285 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。