SharpRSS/SharpRss/Models/CategoryModel.cs

34 lines
915 B
C#
Raw Normal View History

2023-05-18 01:27:11 +02:00
using System;
2023-05-12 15:48:14 +02:00
namespace SharpRss.Models
{
/// <summary>
/// To store and load data from file/database
/// </summary>
public class CategoryModel
2023-05-12 15:48:14 +02:00
{
2023-05-18 01:27:11 +02:00
public CategoryModel()
2023-05-12 23:58:49 +02:00
{
2023-05-18 01:27:11 +02:00
HexColor = $"#{_random.Next(0x1000000):X6}";
CategoryId = Guid.NewGuid().ToString();
2023-05-12 23:58:49 +02:00
}
2023-05-18 01:27:11 +02:00
private readonly Random _random = new Random();
public static CategoryModel Create(string categoryName, string hexColor, string id)
2023-05-12 23:58:49 +02:00
{
2023-05-18 01:27:11 +02:00
CategoryModel catModel = new CategoryModel()
{
Name = categoryName,
HexColor = hexColor,
CategoryId = id
};
return catModel;
2023-05-12 23:58:49 +02:00
}
2023-05-12 15:48:14 +02:00
public string Name { get; set; }
2023-05-18 01:27:11 +02:00
public string HexColor { get; set; }
public string PathIcon { get; set; }
2023-05-18 01:27:11 +02:00
public string CategoryId { get; private set; }
2023-05-12 15:48:14 +02:00
}
}