forked from VahidN/DNTCommon.Web.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeedResultController.cs
More file actions
56 lines (52 loc) · 1.86 KB
/
Copy pathFeedResultController.cs
File metadata and controls
56 lines (52 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace DNTCommon.Web.Core.TestWebApp.Controllers;
public class FeedResultController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult RssFeed()
{
var rssItems = new List<FeedItem>
{
new FeedItem
{
Title = "News 1",
AuthorName = "VahidN",
Content = "line1<br/>line2",
Categories = new List<string> { "MVC", "ASP.NET" },
Url = Url.Action(nameof(Article), typeof(FeedResultController).ControllerName(), new { id = 1 }, this.HttpContext.Request.Scheme),
LastUpdatedTime = DateTimeOffset.UtcNow.AddDays(-1),
PublishDate = DateTimeOffset.UtcNow.AddDays(-2)
},
new FeedItem
{
Title = "News 2 - خبر 2",
AuthorName = "VahidN",
Content = "line1<br/>سطر دوم",
Categories = new List<string> { "MVC", "ASP.NET" },
Url = Url.Action(nameof(Article), typeof(FeedResultController).ControllerName(), new { id = 2 }, this.HttpContext.Request.Scheme),
LastUpdatedTime = DateTimeOffset.UtcNow.AddDays(-1),
PublishDate = DateTimeOffset.UtcNow.AddDays(-2)
}
};
var channel = new FeedChannel
{
FeedTitle = ".NET Core News",
FeedDescription = "Latest .NET Core News",
FeedCopyright = "DNT",
FeedImageContentPath = "",
FeedImageTitle = "",
RssItems = rssItems,
CultureName = "fa-IR"
};
return new FeedResult(channel);
}
public IActionResult Article(int? id)
{
return Content(id == null ? "" : id.ToString());
}
}