SharpRSS/SharpRss/Models/FeedModel.cs

36 lines
915 B
C#
Raw Normal View History

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
{
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
}
public FeedModel(string rssFeedUrl, CategoryModel? category = null)
2023-05-18 01:27:11 +02:00
{
if (category != null)
CategoryId = category.CategoryId;
2023-05-18 01:27:11 +02:00
FeedId = Guid.NewGuid().ToString();
FeedUrl = rssFeedUrl;
2023-05-18 01:27:11 +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()
{
FeedUrl = url,
2023-05-18 01:27:11 +02:00
FeedId = feedId,
CategoryId = categoryId
};
return feedModel;
}
2023-05-12 15:48:14 +02:00
}
}