mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-14 01:25:38 -05:00
34 lines
840 B
C#
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;
|
|
}
|
|
}
|