Ticket/Controllers/UserController.cs

(开头部分) 11KB

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

using Ticket.Model.Models;
using Ticket.Model.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Ticket.Model.Controllers
{
    public class UserController : Controller
    {
        // GET: User
        public ActionResult Index(int role)
        {
            ViewData["Role"] = role;
            return View();
        }

        public JsonResult GetData(int page, int rows, string sort, string order, string name, int role)
        {
            int skip = (page - 1) * rows;
            // var role = ViewData["Role"];
            var ctx = new TicketContext();
            var records = ctx.Users.Where(c => c.Role == (Role)role).AsEnumerable();
            if (!string.IsNullOrEmpty(name))
            {
                records = records.Where(c => c.NickName.Contains(name));
            }
            if (string.IsNullOrEmpty(sort))
            {
                sort = "Id";
                order = "asc";
            }
            var total = records.Count();
            records = records.OrderBy(c => c.Id).Skip(skip).Take(rows);
            return Json(new GridEntity() { total = total, rows = records }, JsonRequestBehavior.AllowGet);
        }

        [AllowAnonymous]
        public ActionResult Login()
        {
            return View();
        }

        [HttpPost]
        [AllowAnonymous]
        public JsonResult Login(User user)
        {
            var response = new ResponseEntity() { code = 1, msg = string.Empty };
            if (user == null)
            {
                response.code = -1;
                response.msg = "传回的实体为空";
                return Json(response);
            }
            Md5Helper md5 = new Md5Helper();
            var crypt = md5.EnCrypt(user.Password);
            var ctx = new TicketContext();
            var temp = ctx.Users.FirstOrDefault(c => c.Account == user.Account && c.Role==user.Role);
后面还有 260 行代码,购买后查看完整代码

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

AI 解读 AI

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

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