public JsonResult Edit(string id, CategoryModel model) { var bll = new EvaluateBLL(); var success = true; var message = "保存成功"; try { if (string.IsNullOrEmpty(id)) { bll.Add(new EvaluateCategoryEntity() { Category = model.Category, CreateTime = DateTime.Now, ParentCategoryId = model.ParentCategory == null ? null : model.ParentCategory.CategoryId }); } else { bll.Edit(new EvaluateCategoryEntity() { Category = model.Category, CreateTime = DateTime.Now, ParentCategoryId = model.ParentCategory.CategoryId }); } } catch (Exception ex) { success = false; message = ex.Message; } return(Json(new AjaxResult { type = success ? ResultType.success : ResultType.error, message = HttpUtility.JavaScriptStringEncode(message) })); }
public JsonResult ClassEdit(string id, CategoryModel model) { var bll = new EvaluateBLL(); var weight = new WeightSetBLL(); var success = true; var message = "保存成功"; try { bll.Edit(new EvaluateCategoryEntity() { Category = model.Category, CategoryId = model.CategoryId, ParentCategoryId = model.ParentCategory == null ? null : model.ParentCategory.ToString(), SortCode = model.SortCode, CreateTime = DateTime.Now }); //同步修改班组权重表信息 WeightSetEntity entity = weight.GetEntity(id); if (entity != null) { entity.ClassName = model.Category; weight.SaveForm(id, entity); } } catch (Exception ex) { success = false; message = ex.Message; } return(Json(new AjaxResult { type = success ? ResultType.success : ResultType.error, message = HttpUtility.JavaScriptStringEncode(message) })); }