public string SaveTags(string snippetId, string tags) { using (busCodeSnippet busSnippet = new busCodeSnippet()) { if (busSnippet.Load(snippetId) == null) { throw new ArgumentException("Invalid snippetId passed."); } if (!IsEditAllowed(busSnippet.Entity) && !AppUserState.IsAdmin) { throw new AccessViolationException("You are not allowed to edit this snippet."); } busSnippet.Entity.Tags = tags; if (!busSnippet.Save()) { throw new InvalidOperationException("Unable to save snippet: " + busSnippet.ErrorMessage); } string tagResult = busSnippet.GetTagLinkList(tags); return(tagResult); } }
public string SaveTags(string snippetId, string tags) { using (busCodeSnippet busSnippet = new busCodeSnippet()) { if (busSnippet.Load(snippetId) == null) throw new ArgumentException("Invalid snippetId passed."); if (!IsEditAllowed(busSnippet.Entity) && !AppUserState.IsAdmin) throw new AccessViolationException("You are not allowed to edit this snippet."); busSnippet.Entity.Tags = tags; if (!busSnippet.Save()) throw new InvalidOperationException("Unable to save snippet: " + busSnippet.ErrorMessage); string tagResult = busSnippet.GetTagLinkList(tags); return tagResult; } }