public OperationResult AddMaterial(RequestOperation <MaterialData> request) { var result = new OperationResult(); try { if (String.IsNullOrEmpty(request.Body.Url)) { result.Message = "缺少请求参数"; return(result); } var data = MaterialDA.AddMaterial(request); if (data <= 0) { result.ErrCode = 1; result.Message = "添加资源失败"; } else { result.ErrCode = 0; result.Message = "ok"; } } catch (Exception ex) { Logger.WriteException("AddMaterial", ex, request); result.ErrCode = -1; result.Message = ex.Message; } return(result); }
private async void UploadMaterialExecute(object obj) { var newGuid = Guid.NewGuid(); string id = Convert.ToBase64String(newGuid.ToByteArray()); Material.MaterialID = id.Remove(id.Length - 2, 2); Material.CollectorList = new List <string>(); await MaterialDA.AddMaterial(Material); await Application.Current.MainPage.Navigation.PopAsync(); }