mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-13 17:22:48 -05:00
Start modernization
This commit is contained in:
@@ -1,15 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Realms;
|
||||
|
||||
namespace FeedCenter
|
||||
{
|
||||
public partial class Category
|
||||
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() };
|
||||
return new Category { Id = Guid.NewGuid() };
|
||||
}
|
||||
public static Category CreateDefault()
|
||||
{
|
||||
return new Category { Id = Guid.NewGuid(), Name = DefaultCategoryName };
|
||||
}
|
||||
|
||||
public bool IsDefault => Name == "< default >";
|
||||
public bool IsDefault => Name == DefaultCategoryName;
|
||||
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public int SortKey => IsDefault ? 0 : 1;
|
||||
|
||||
Reference in New Issue
Block a user