Added database loading logic

This commit is contained in:
2025-01-14 14:05:15 +01:00
parent 313f6e046a
commit 6115dcf8e1
13 changed files with 139 additions and 35 deletions

View File

@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HopFrame.Testing.Models;
public class Post {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[MaxLength(255)]
public required string Caption { get; set; }
public required string Content { get; set; }
[ForeignKey("author")]
public User? Author { get; set; }
}

View File

@@ -7,4 +7,8 @@ public class User {
public string? Password { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public override string ToString() {
return Id.ToString();
}
}