这个是 我 ArticleUpd.aspx.cs(文章修改页面 web 层) 里面的,是不是应该封装到 BLL 层里面?
using System;using System.Collections;using Lib;using System.Collections.Generic;namespace WEB.mgr{ public partial class UpdArticle : System.Web.UI.Page { protected bool Exists = false; protected MODEL.article Article = null; protected void Page_Load(object sender, EventArgs e) { string ID = Request.QueryString["ID"]; if (StringHelper.isSafeNum(ID)) { DAL.article article = new DAL.article(); Article = article.Get(Convert.ToInt32(ID)); Exists = true; string action = Request.QueryString["action"]; if (action == null) action = ""; if (action=="save") { string title = Request.Form["title"]; if (title == null) { title = ""; } string content = Request.Form["content"]; if (content == null) { content = ""; } string CategoryID = Request.Form["CategoryID"]; if (!Lib.StringHelper.isSafeNum(CategoryID)) { CategoryID = "0"; } string tags = Request.Form["tags"]; if (tags == null) { tags = ""; } tags = tags.Trim().Replace(",", ","); string[] tagArr=tags.Split(','); MODEL.article artMOD = new MODEL.article(Convert.ToInt32(ID), Convert.ToInt32(CategoryID), title, content); BLL.article art = new BLL.article(); List<MODEL.tag> tagCollection=new List<MODEL.tag>(); for (int i = 0; i < tagArr.Length; i++) { tagCollection.Add(new MODEL.tag(tagArr[i])); } art.Update(artMOD, tagCollection.ToArray()); } } } protected void OutPutCategory() { if (Exists) { List<MODEL.category> list = new BLL.category().GetAll(); if (Article.CID==0) { Response.Write("<option selected=\"selected\" value=\"0\">默认类别</option>\n"); } for (int i = 0; i < list.Count; i++) { if (Article.CID == list[i].ID) { Response.Write("<option selected=\"selected\" value=\"" + list[i].ID + "\">" + list[i].Name + "</option>\n"); } else { Response.Write("<option value=\"" + list[i].ID + "\">" + list[i].Name + "</option>\n"); } } } } protected string GetArticleTags() { return new BLL.article().getTags(Article.ID); } }}
是不是 ,只传递过去这一部分,然后就由BLL 层来处理呢?
string title = Request.Form["title"]; if (title == null) { title = ""; } string content = Request.Form["content"]; if (content == null) { content = ""; } string CategoryID = Request.Form["CategoryID"]; if (!Lib.StringHelper.isSafeNum(CategoryID)) { CategoryID = "0"; } string tags = Request.Form["tags"]; if (tags == null) { tags = ""; }
- 5 回答
- 0 关注
- 429 浏览
添加回答
举报
0/150
提交
取消