BuchhaltungBlazor/BuchhaltungBlazor/Data/SubCategory.cs

29 lines
647 B
C#

using System.ComponentModel.DataAnnotations;
namespace Buchhaltung;
public class SubCategory {
//Constructors
public SubCategory(uint id, string name) {
Id = id;
Name = name;
}
public SubCategory(string name) {
Name = name;
}
//Primary Key
[Key] public uint Id { get; private set; }
//Navigation property
public IList<Booking>? Bookings { get; set; }
//Properties
public string? Name { get; private set; }
public static SubCategory FromCsv(string csvLine) {
string[] values = csvLine.Split(',');
return new(uint.Parse(values[0]), values[1]);
}
}