public ActionResult SaveResourceInfo(SysresourceModel model) { var resultMode = new ResponseBaseModel <dynamic> { ResultCode = ResponceCodeEnum.Success, Message = "响应成功" }; var server = new ResourceService(); var saveModel = new SysresourceModel(); if (model == null) { Debug.WriteLine("请求参数为空"); resultMode.Message = "保存失败"; resultMode.ResultCode = ResponceCodeEnum.Fail; return(Json(resultMode, JsonRequestBehavior.AllowGet)); } if (model.Id > 0) { saveModel = server.Get(model.Id); if (saveModel == null) { resultMode.Message = "该记录已经被删除"; resultMode.ResultCode = ResponceCodeEnum.Fail; return(Json(resultMode, JsonRequestBehavior.AllowGet)); } } else { saveModel.CreateBy = CurrentModel.Id.ToString(); saveModel.CreateTime = DateTime.Now; } saveModel.Id = model.Id; saveModel.IsDel = FlagEnum.HadZore.GetHashCode(); saveModel.ResourceRemark = model.ResourceRemark; saveModel.ResourceType = model.ResourceType; saveModel.ResourceUrl = model.ResourceUrl; saveModel.Sort = model.Sort; try { server.SaveModel(saveModel); return(Json(resultMode, JsonRequestBehavior.AllowGet)); } catch (Exception e) { Debug.WriteLine(e.Message); resultMode.Message = "保存失败"; resultMode.ResultCode = ResponceCodeEnum.Fail; resultMode.Data = e.Message; return(Json(resultMode, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 保存信息 /// </summary> /// <param name="saveModel"></param> public void SaveModel(SysresourceModel saveModel) { _dataAccess.SaveModel(saveModel); }