/// <summary> /// 提交邮件分类(新增、编辑) /// </summary> /// <param name="KeyValue">主键</param> /// <param name="FullName">文件夹名称</param> /// <returns></returns> public ActionResult SubmitFormEmailCategory(string KeyValue, string FullName) { try { Base_EmailCategory entity = new Base_EmailCategory(); entity.FullName = FullName; int IsOk = 0; string Message = KeyValue == "" ? "新增成功。" : "编辑成功。"; if (!string.IsNullOrEmpty(KeyValue)) { entity.Modify(KeyValue); IsOk = DataFactory.Database().Update(entity); } else { entity.Create(); IsOk = DataFactory.Database().Insert(entity); } return(Content(new JsonMessage { Success = true, Code = IsOk.ToString(), Message = Message }.ToString())); } catch (Exception ex) { return(Content(new JsonMessage { Success = false, Code = "-1", Message = "操作失败:" + ex.Message }.ToString())); } }
/// <summary> /// 删除邮件分类 /// </summary> /// <param name="KeyValue">主键</param> /// <returns></returns> public ActionResult DeleteEmailCategory(string KeyValue) { try { var Message = "删除失败。"; Base_EmailCategory entity = new Base_EmailCategory(); entity.EmailCategoryId = KeyValue; int IsOk = DataFactory.Database().Delete(entity); if (IsOk > 0) { Message = "删除成功。"; } return(Content(new JsonMessage { Success = true, Code = IsOk.ToString(), Message = Message }.ToString())); } catch (Exception ex) { return(Content(new JsonMessage { Success = false, Code = "-1", Message = "操作失败:" + ex.Message }.ToString())); } }
/// <summary> /// 邮件分类表单赋值 /// </summary> /// <param name="KeyValue">主键值</param> /// <returns></returns> public virtual ActionResult SetFormEmailCategory(string KeyValue) { Base_EmailCategory entity = DataFactory.Database().FindEntity <Base_EmailCategory>(KeyValue); return(Content(entity.ToJson())); }