public bool TryConvertModel(IndexViewModel model, out SyndicationFeed syndicationFeed) { syndicationFeed = new SyndicationFeed( model.SiteName, model.SiteName, _currentRequest.GetUrl(), "AllPostsFeed", new DateTimeOffset(DateTime.Now)) { Description = new TextSyndicationContent(model.SiteName) }; List <SyndicationItem> feedItems = new List <SyndicationItem>(); model.Posts.Each(post => { var feedItem = new SyndicationItem( post.Title, post.Body, new Uri(_urlResolver.PublishedPost(post).ToFullUrl()), new Uri(_urlResolver.PublishedPost(post).ToFullUrl()).ToString(), new DateTimeOffset(post.Published)); feedItem.Authors.Add(new SyndicationPerson(post.User.Email, post.User.DisplayName, post.User.Url)); post.Tags.Each(tag => feedItem.Categories.Add(new SyndicationCategory(tag.Name))); feedItems.Add(feedItem); }); syndicationFeed.Items = feedItems.AsEnumerable(); return(true); }
public RedirectToOldBlogViewModel Index(RedirectToOldBlogSetupViewModel inModel) { var currentUrl = _currentRequest.GetUrl().AbsoluteUri; var newUrl = currentUrl.Replace("blog.fohjin.com", "fohjin.blogspot.com"); return(new RedirectToOldBlogViewModel { ResultOverride = new RedirectResult(newUrl) }); }