/// <summary> /// 添加问答分类 /// </summary> /// <param name="model">新建问答分类模型</param> public void CreateQuestionCategory(NewQuestionCategoryModel model) { IRepository <BlogQuestionCategory> categoryRep = Factory.Factory <IRepository <BlogQuestionCategory> > .GetConcrete <BlogQuestionCategory>(); try { categoryRep.Add(new BlogQuestionCategory(model.CategoryName, model.Description, model.Icon, model.Priority)); categoryRep.PersistAll(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["categoryname"] != null) { CategoryService myservice = new CategoryService(); NewQuestionCategoryModel model = new NewQuestionCategoryModel() { CategoryName = Request.Form["categoryname"].ToString(), Description = Request.Form["decription"].ToString(), Icon = "fly_note_icon", Priority = System.UInt16.Parse(Request.Form["priority"].ToString()) }; myservice.CreateQuestionCategory(model); Response.Redirect("QuestionCategoryList.aspx"); } }