Files
FeedCenter/Application/Feeds/Category.cs
2023-03-10 12:18:03 -05:00

34 lines
840 B
C#

using System;
using System.Collections.Generic;
using Realms;
namespace FeedCenter
{
public class Category : RealmObject
{
private const string DefaultCategoryName = "< default >";
[PrimaryKey]
[MapTo("ID")]
public Guid Id { get; set; }
public string Name { get; set; }
[Ignored]
public ICollection<Feed> Feeds { get; set; }
public static Category Create()
{
return new Category { Id = Guid.NewGuid() };
}
public static Category CreateDefault()
{
return new Category { Id = Guid.NewGuid(), Name = DefaultCategoryName };
}
public bool IsDefault => Name == DefaultCategoryName;
// ReSharper disable once UnusedMember.Global
public int SortKey => IsDefault ? 0 : 1;
}
}