• 登录注册U


    Controller

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;

    namespace Login.Mvc.Controllers
    {
    using Login.BLL;
    using Login.Model;
    using System.Web.Mvc;
    using Login.Mvc.Fatier;
    public class LoginController : Controller
    {
    UserBll bll = new UserBll();
    // GET: Login
    public ActionResult Index()
    {
    ViewBag.Name = Session["UName"];
    return View();
    }
    public ActionResult Add()
    {
    return View();
    }

    public ActionResult Login()
    {
    ViewBag.Name = Session["UName"];
    return View();
    }
    [LoginFatier]
    public ActionResult Updata()
    {
    ViewBag.Name = Session["UName"];
    return View();
    }


    /// <summary>
    /// 获取所有信息
    /// </summary>
    /// <param name="Name"></param>
    /// <returns></returns>
    [HttpPost]
    public int GetUser(string Name)
    {
    var result = bll.GetUser().Where(m => m.UserName.Equals(Name)).ToList();
    //int i = result.Count;
    if (result.Count() > 0)
    {
    return 1;
    }
    else {
    return 0;
    }
    }
    /// <summary>
    /// 注册用户
    /// </summary>
    /// <param name="user"></param>
    /// <returns></returns>
    [HttpPost]
    public int Add(User user)
    {
    var result = bll.AddUser(user);
    return result;
    }
    /// <summary>
    /// 用户登陆
    /// </summary>
    /// <param name="Name"></param>
    /// <param name="Password"></param>
    /// <returns></returns>
    public int UserLogin(string Name,string Password)
    {
    var result = bll.UserLogin(Name, Password);
    if (result > 0)
    {
    Session["UName"] = Name;
    Session["ID"] = result;
    //if (Session["URL"] != null)
    //{
    // Response.Redirect(Session["URL"].ToString());
    //}
    }
    return result;
    }
    /// <summary>
    ///修改密码
    /// </summary>
    /// <param name="Password"></param>
    /// <returns></returns>
    public int UserUpdata(string Password)
    {
    int Id = Convert.ToInt32(Session["ID"]);
    var result = bll.UserUpdate(Id,Password);
    return result;
    }
    }
    }

  • 相关阅读:
    lampp、xampp安装文档
    tomcat下配置https方式
    1.6:怎么学习Linux
    1.5:linux的应用领域
    1.3:linux的优点和缺点
    1.4:Linux发行版本详解
    1.2:liunx和unix的区别
    1.1:Linux系统简介
    mysql中获取表名&字段名的查询语句
    kettle组件-输出
  • 原文地址:https://www.cnblogs.com/hianb/p/10003138.html
Copyright © 2020-2023  润新知