changecaname.ashx

来自「牛腩新闻发布系统,采用三成架构」· ASHX 代码 · 共 49 行

ASHX
49
字号
<%@ WebHandler Language="C#" Class="ChangeCaName" %>
/*
 * 创建人:牛腩
 * 创建时间:2008-12-14 22:02:31
 * 版权所有:牛腩&众志网(www.tg029.com)
 */
using System;
using System.Web;
using BLL;
using Model;

public class ChangeCaName : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";

        string caid = context.Request.QueryString["caid"];
        string caname = context.Server.UrlDecode(context.Request.QueryString["caname"]);
        // 判断数据库中是否已经存在同名类别
        if (new CategoryManager().IsExists(caname))
        {
            context.Response.Write("false");
            return;
        }
        // 更改数据库类别名
        Category ca = new Category(caid, caname);
        bool b = new CategoryManager().Update(ca);
        if (b)
        {
            context.Response.Write("true");
        }
        else
        {
            context.Response.Write("false");
        }

    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?