Dev2.Runtime.ServiceModel.WebSources.Save C# (CSharp) Method

Save() public method

public Save ( string args, System.Guid workspaceId, System.Guid dataListId ) : string
args string
workspaceId System.Guid
dataListId System.Guid
return string
        public string Save(string args, Guid workspaceId, Guid dataListId)
        {
            try
            {
                var source = JsonConvert.DeserializeObject<WebSource>(args);

                _resourceCatalog.SaveResource(workspaceId, source);
                if(workspaceId != GlobalConstants.ServerWorkspaceID)
                {
                    _resourceCatalog.SaveResource(GlobalConstants.ServerWorkspaceID, source);
                }

                return source.ToString();
            }
            catch(Exception ex)
            {
                RaiseError(ex);
                return new ValidationResult { IsValid = false, ErrorMessage = ex.Message }.ToString();
            }
        }

Usage Example

Esempio n. 1
0
 public void WebSourcesSaveWithInValidArgsExpectedInvalidValidationResult()
 {
     var handler = new WebSources();
     var jsonResult = handler.Save("root:'hello'", Guid.Empty, Guid.Empty);
     var result = JsonConvert.DeserializeObject<ValidationResult>(jsonResult);
     Assert.IsFalse(result.IsValid);
 }
All Usage Examples Of Dev2.Runtime.ServiceModel.WebSources::Save