Subtext.Framework.Format.UrlFormats.GetEditLink C# (CSharp) Method

GetEditLink() public static method

Builds the HyperLink.NavigateUrl for an EditPost Link by determining the current Subfolder and adding it to the URL if necessary.
public static GetEditLink ( Entry entry ) : string
entry Subtext.Framework.Components.Entry The entry to be edited
return string
        public static string GetEditLink(Entry entry)
        {
            //This is too small a concatenation to create a
            //the overhead of a StringBuilder. If perf is really a hit here,
            //we can pass in a string builder.
            String app = Config.CurrentBlog.Subfolder;

            string url = (String.IsNullOrEmpty(app)) ? "~" : "~/" + app;
            if(entry.PostType == PostType.BlogPost)
                url += "/Admin/Posts/Edit.aspx?PostID=" + entry.Id + "&return-to-post=true";
            else if(entry.PostType == PostType.Story)
                url += "/Admin/Articles/Edit.aspx?PostID=" + entry.Id + "&return-to-post=true";
            else
                throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Post type {0} not expected to have an edit link.", entry.PostType));
            return url;
        }