2023-05-18 01:27:11 +02:00
|
|
|
|
using System;
|
2023-05-15 20:42:42 +02:00
|
|
|
|
using CodeHollow.FeedReader;
|
2023-05-12 15:48:14 +02:00
|
|
|
|
|
|
|
|
|
namespace SharpRss.Models
|
|
|
|
|
{
|
2023-05-15 15:53:08 +02:00
|
|
|
|
public class FeedModel
|
2023-05-12 15:48:14 +02:00
|
|
|
|
{
|
2023-05-18 01:27:11 +02:00
|
|
|
|
private FeedModel()
|
2023-05-12 23:58:49 +02:00
|
|
|
|
{
|
2023-05-18 01:27:11 +02:00
|
|
|
|
|
2023-05-12 23:58:49 +02:00
|
|
|
|
}
|
2023-05-18 20:15:31 +02:00
|
|
|
|
public FeedModel(string rssFeedUrl, CategoryModel? category = null)
|
2023-05-18 01:27:11 +02:00
|
|
|
|
{
|
2023-05-18 20:15:31 +02:00
|
|
|
|
if (category != null)
|
|
|
|
|
CategoryId = category.CategoryId;
|
2023-05-18 01:27:11 +02:00
|
|
|
|
FeedId = Guid.NewGuid().ToString();
|
2023-05-18 20:15:31 +02:00
|
|
|
|
FeedUrl = rssFeedUrl;
|
2023-05-18 01:27:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-18 20:15:31 +02:00
|
|
|
|
public string FeedUrl { get; set; }
|
2023-05-18 01:27:11 +02:00
|
|
|
|
public string FeedId { get; private set; }
|
|
|
|
|
public string CategoryId { get; set; } = "";
|
2023-05-12 23:58:49 +02:00
|
|
|
|
|
2023-05-18 01:27:11 +02:00
|
|
|
|
public static FeedModel Create(string url, string feedId, string categoryId)
|
|
|
|
|
{
|
|
|
|
|
FeedModel feedModel = new FeedModel()
|
|
|
|
|
{
|
2023-05-18 20:15:31 +02:00
|
|
|
|
FeedUrl = url,
|
2023-05-18 01:27:11 +02:00
|
|
|
|
FeedId = feedId,
|
|
|
|
|
CategoryId = categoryId
|
|
|
|
|
};
|
|
|
|
|
return feedModel;
|
|
|
|
|
}
|
2023-05-12 15:48:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|