ASP.Net-基本CRUD-APP 修改

<%@ WebHandler Language="C#" Class="UpdateUserInfo" %>

using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using WebProject.Model;
using WebProject.BLL;

public class UpdateUserInfo : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/html";
        int id = Convert.ToInt32(context.Request.Form["txtId"]);
        string newName = context.Request.Form["txtName"];
        string newPwd = context.Request.Form["txtPwd"];
        UserInfo user = new UserInfo() { UserId = id, UserName = newName, UserPwd = newPwd };
        UserInfoBLL bll = new UserInfoBLL();
        if (bll.UpdateUserInfo(user))
        {
            context.Response.Redirect("UserInfoList.ashx");
        }
        else
        {
            context.Response.Redirect("Error.html");
        }   

    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}

猜你喜欢

转载自blog.csdn.net/dxm809/article/details/88793223