Added database loading logic
This commit is contained in:
17
testing/HopFrame.Testing/Models/Post.cs
Normal file
17
testing/HopFrame.Testing/Models/Post.cs
Normal 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; }
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user