BuchhaltungBlazor/Data/Category.cs

29 lines
616 B
C#

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