/// <summary> /// 转换OpenAPI视图和OpenAPI实体 /// </summary> /// <param name="data"></param> /// <returns></returns> private List <InternetKeywordInfo> CovertVMtoEntity(InternetKeywordVM data) { if (data == null) { return(new List <InternetKeywordInfo>()); } data.OperateUser = new UserInfo { SysNo = CPApplication.Current.LoginUser.UserSysNo, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; data.OperateDate = DateTime.Now; var dataSource = data.Spilt(); return(dataSource); }
public static List <InternetKeywordInfo> Spilt(this InternetKeywordVM vm) { if (vm == null || String.IsNullOrWhiteSpace(vm.SearchKeyword)) { return(new List <InternetKeywordInfo>()); } var arrayList = vm.SearchKeyword.Split('\r'); var _vm = new List <InternetKeywordInfo>(); for (var i = 0; i < arrayList.Count(); i++) { var entity = new InternetKeywordInfo { OperateDate = vm.OperateDate, OperateUser = vm.OperateUser, Searchkeyword = arrayList[i], Status = vm.Status }; _vm.Add(entity); } return(_vm); }
private void Bind() { _vm = new InternetKeywordVM(); DataContext = _vm; }
/// <summary> /// 创建OpenAPI /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void CreateKeyword(InternetKeywordVM data, EventHandler <RestClientEventArgs <OpenAPIMasterInfo> > callback) { var tempdata = CovertVMtoEntity(data); _restClient.Create(CreateRelativeUrl, tempdata, callback); }