/// <summary> /// 添加分类 /// </summary> /// <param name="context"></param> private void AddCatory(HttpContext context) { ModelCatogoryService Catogorybll = new ModelCatogoryService(); try { ModelCatogory model = new ModelCatogory(); string Name = context.Request["Name"].SafeToString(); string Status = context.Request["Status"]; string ID = context.Request["ID"].SafeToString(); string SortNum = context.Request["SortNum"].SafeToString(); model.Name = Name; model.Status = int.Parse(Status); model.SortNum = int.Parse(SortNum); if (ID.Length > 0) { model.ID = int.Parse(ID); jsonModel = Catogorybll.Update(model); } else { jsonModel = Catogorybll.Add(model); } } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }
/// <summary> /// 删除分类 /// </summary> /// <param name="context"></param> private void DelCatagory(HttpContext context) { ModelCatogoryService Catogorybll = new ModelCatogoryService(); try { int ID = int.Parse(context.Request["ID"]); jsonModel = Catogorybll.Delete(ID); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }