public BasicResponse <EnumcodeInfo> UpdateEnumcode(EnumcodeUpdateRequest enumcoderequest) { var _enumcode = ObjectConverter.Copy <EnumcodeInfo, EnumcodeModel>(enumcoderequest.EnumcodeInfo); _Repository.UpdateEnumcode(_enumcode); var enumcoderesponse = new BasicResponse <EnumcodeInfo>(); enumcoderesponse.Data = ObjectConverter.Copy <EnumcodeModel, EnumcodeInfo>(_enumcode); return(enumcoderesponse); }
/// <summary> /// 保存枚举 /// </summary> /// <param name="enumcoderequest"></param> /// <returns></returns> public BasicResponse <EnumcodeInfo> SaveEnumCode(EnumcodeAddRequest enumcoderequest) { EnumcodeInfo dto = null; BasicResponse <EnumcodeInfo> Result = new BasicResponse <EnumcodeInfo>(); dto = enumcoderequest.EnumcodeInfo; if (dto == null) { //throw new Exception("枚举类型对象为空,请检查是否已赋值!"); ThrowException("SaveEnumCode", new Exception("枚举类型对象为空,请检查是否已赋值!")); } if (dto.LngEnumValue == null) { //throw new Exception("枚举DTO中LngEnumValue属性未赋值!"); ThrowException("SaveEnumCode", new Exception("枚举DTO中LngEnumValue属性未赋值!")); } if (dto.StrEnumDisplay.Trim() == "") { //throw new Exception("枚举DTO中strEnumDisplay属性未赋值!"); ThrowException("SaveEnumCode", new Exception("枚举DTO中strEnumDisplay属性未赋值!")); } if (dto.InfoState == InfoState.NoChange) { //throw new Exception("DTO对象未设置状态,请先设置!"); ThrowException("SaveEnumCode", new Exception("DTO对象未设置状态,请先设置!")); } if (dto.EnumTypeID == "0") { //throw new Exception("枚举类型必须设置值,属性名EnumTypeID!"); ThrowException("SaveEnumCode", new Exception("枚举类型必须设置值,属性名EnumTypeID!")); } try { int ID = 0; if (dto.InfoState == InfoState.AddNew) { Result = AddEnumcode(enumcoderequest); } else { EnumcodeUpdateRequest updaterequest = new EnumcodeUpdateRequest(); updaterequest.EnumcodeInfo = enumcoderequest.EnumcodeInfo; Result = UpdateEnumcode(updaterequest); } } catch (System.Exception ex) { ThrowException("SaveEnumCode", ex); } return(Result); }
public BasicResponse <EnumcodeInfo> UpdateEnumcode(EnumcodeUpdateRequest enumcoderequest) { var responseStr = HttpClientHelper.Post(Webapi + "/v1/Enumcode/Update?token=" + Token, JSONHelper.ToJSONString(enumcoderequest)); return(JSONHelper.ParseJSONString <BasicResponse <EnumcodeInfo> >(responseStr)); }
public BasicResponse <EnumcodeInfo> UpdateEnumcode(EnumcodeUpdateRequest enumcoderequest) { return(_enumcodeService.UpdateEnumcode(enumcoderequest)); }