This commit is contained in:
Paul Schneider 2025-07-07 07:49:18 +01:00
commit 253a2919f3
36 changed files with 328 additions and 146 deletions

View file

@ -21,7 +21,6 @@ namespace Yavsc.ViewModels.Blog
[Display(Name = "Liste de contrôle d'accès")]
public virtual List<CircleAuthorizationToBlogPost>? ACL { get; set; }
public bool Publish { get; set; }
}
}

View file

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Models.Blog;
namespace Yavsc.ViewModels.Blog;
@ -8,4 +9,37 @@ public class BlogPostEditViewModel : BlogPostBase
[Required]
public required long Id { get; set; }
public bool Publish { get; set; }
public BlogPostEditViewModel()
{
}
public static BlogPostEditViewModel From(BlogPost blogInput)
{
return new BlogPostEditViewModel
{
Id = blogInput.Id,
Title = blogInput.Title,
Publish = false,
Photo = blogInput.Photo,
Content = blogInput.Content,
ACL = blogInput.ACL
};
}
public static BlogPostEditViewModel FromViewModel(BlogPostEditViewModel blogInput)
{
return new BlogPostEditViewModel
{
Id = blogInput.Id,
Title = blogInput.Title,
Publish = false,
Photo = blogInput.Photo,
Content = blogInput.Content,
ACL = blogInput.ACL
};
}
}