Added entry saving support
This commit is contained in:
@@ -23,7 +23,8 @@ Welcome to your new Fluent Blazor app.
|
||||
Id = Guid.CreateVersion7(),
|
||||
FirstName = first,
|
||||
LastName = last,
|
||||
Username = username
|
||||
Username = username,
|
||||
Password = GenerateName(Random.Shared.Next(8, 16))
|
||||
};
|
||||
|
||||
Context.Users.Add(user);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace HopFrame.Testing.Models;
|
||||
@@ -15,5 +16,13 @@ public class Post {
|
||||
[ForeignKey("author")]
|
||||
public User? Author { get; set; }
|
||||
|
||||
public bool Published { get; set; }
|
||||
/*public bool Published { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public DateOnly Created { get; set; }
|
||||
|
||||
public TimeOnly At { get; set; }*/
|
||||
|
||||
public ListSortDirection Type { get; set; }
|
||||
}
|
||||
@@ -24,7 +24,8 @@ builder.Services.AddHopFrame(options => {
|
||||
options.AddDbContext<DatabaseContext>(context => {
|
||||
context.Table<User>(table => {
|
||||
table.Property(u => u.Password)
|
||||
.List(false);
|
||||
.List(false)
|
||||
.DisplayValue(false);
|
||||
|
||||
table.Property(u => u.FirstName)
|
||||
.SetDisplayName("First Name");
|
||||
@@ -33,20 +34,17 @@ builder.Services.AddHopFrame(options => {
|
||||
.SetDisplayName("Last Name");
|
||||
|
||||
table.Property(u => u.Id)
|
||||
.Sortable(false);
|
||||
.Sortable(false)
|
||||
.ValueTemplate(Guid.CreateVersion7);
|
||||
});
|
||||
|
||||
/* context.Table<Post>()
|
||||
.Property(p => p.Author)
|
||||
.DisplayedProperty(u => u!.Username); */
|
||||
context.Table<Post>()
|
||||
.Property(p => p.Author)
|
||||
.Format(user => $"{user?.FirstName} {user?.LastName}");
|
||||
|
||||
context.Table<Post>()
|
||||
.Property(p => p.Id)
|
||||
.SetDisplayName("ID")
|
||||
.Editable(true);
|
||||
.SetDisplayName("ID");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user