2024-04-23 12:09:32 +03:30
|
|
|
|
using Microsoft.IdentityModel.Tokens;
|
2024-04-16 20:01:34 +03:30
|
|
|
|
|
|
|
|
|
|
namespace Netina.Domain.Entities.Blogs;
|
2023-12-20 10:37:44 +03:30
|
|
|
|
|
|
|
|
|
|
public partial class Blog
|
|
|
|
|
|
{
|
|
|
|
|
|
public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
|
|
|
|
|
|
{
|
2024-04-23 12:09:32 +03:30
|
|
|
|
var slug = StringExtensions.GetSlug(title);
|
2024-04-22 13:33:39 +03:30
|
|
|
|
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId);
|
2023-12-20 10:37:44 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-23 12:09:32 +03:30
|
|
|
|
public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
|
2024-04-22 13:33:39 +03:30
|
|
|
|
{
|
2024-04-23 12:09:32 +03:30
|
|
|
|
if (slug.IsNullOrEmpty())
|
|
|
|
|
|
slug = StringExtensions.GetSlug(title);
|
2024-04-22 13:33:39 +03:30
|
|
|
|
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId);
|
|
|
|
|
|
}
|
2023-12-20 10:37:44 +03:30
|
|
|
|
public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)
|
|
|
|
|
|
{
|
|
|
|
|
|
var file = BlogStorageFile.Create(name, fileLocation, fileName, isHeader, isPrimary, fileType, this.Id);
|
|
|
|
|
|
Files.Add(file);
|
|
|
|
|
|
return file;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class BlogStorageFile
|
|
|
|
|
|
{
|
|
|
|
|
|
public static BlogStorageFile Create(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType, Guid blogId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new BlogStorageFile(name, fileLocation, fileName, isHeader, isPrimary, fileType, blogId);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class BlogCategory
|
|
|
|
|
|
{
|
2024-05-07 11:01:55 +03:30
|
|
|
|
public static BlogCategory Create(string name, string description, bool isMain)
|
2023-12-20 10:37:44 +03:30
|
|
|
|
{
|
2024-04-23 12:09:32 +03:30
|
|
|
|
var slug = StringExtensions.GetSlug(name);
|
2024-05-07 11:01:55 +03:30
|
|
|
|
return new BlogCategory(name, slug, description, isMain);
|
2024-04-23 12:09:32 +03:30
|
|
|
|
}
|
2024-05-07 11:01:55 +03:30
|
|
|
|
public static BlogCategory Create(string name, string slug, string description,bool isMain)
|
2024-04-23 12:09:32 +03:30
|
|
|
|
{
|
|
|
|
|
|
if (slug.IsNullOrEmpty())
|
|
|
|
|
|
slug = StringExtensions.GetSlug(name);
|
2024-05-07 11:01:55 +03:30
|
|
|
|
return new BlogCategory(name, slug, description, isMain);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetParent(Guid parentId)
|
|
|
|
|
|
{
|
|
|
|
|
|
ParentId = parentId;
|
2023-12-20 10:37:44 +03:30
|
|
|
|
}
|
|
|
|
|
|
}
|