Skip to content

Commit

Permalink
Minor code improvements (#119)
Browse files Browse the repository at this point in the history
* Features/upgrate to dotnet 6 (#108)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Features/fix email bugs (#110)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Features/fix email bugs (#112)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Feature/fix email send issues (#114)

* Removed development files

* Updated .gitignore

* Added MailKit library

* Implemented e-mail sender with MailKit

* Feature/minor changes (#116)

* Updated nuget packages

* Improved HtmlHelperExtensions logic and added possibility to use with slugs

* Added "About me" menu item

* Feature/code improvements (#117)

* Add possibility to use global.json

* Add global.json file with targeting SDK 6.0.403

* Removed warnings

* Add exclusion of generated code

* Exclude Identity pages from null check

* Update packages; Add ardalis.GuardClauses

* Remove warnings

* Remove null warnings; Minor code improvements

* Fixed post not being saved

* Fixed post not being saved

* Add filter to prevent articles to appear before publishing time

* Add filter to prevent articles to appear before publishing time

* Add about me and subscribe; Reorder menu

* Add Author partial view

* Change DateTime format

* Add SASS package

* Reduce padding; Add max-height of 100%

* Minor improvements (#118)

* Develop (#113)

* Features/upgrate to dotnet 6 (#108)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Features/fix email bugs (#110)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Features/fix email bugs (#112)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Bugfix for e-mail sending (#115)

* Features/upgrate to dotnet 6 (#108)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Features/fix email bugs (#110)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Features/fix email bugs (#112)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Feature/fix email send issues (#114)

* Removed development files

* Updated .gitignore

* Added MailKit library

* Implemented e-mail sender with MailKit
  • Loading branch information
davidsonsousa authored Dec 22, 2022
1 parent 6ae61af commit 63d5f1f
Show file tree
Hide file tree
Showing 127 changed files with 916 additions and 630 deletions.
27 changes: 16 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# There already existed an .editorconfig file in this directory. Copy rules from this .editorconfig.inferred file to the existing .editorconfig file as desired to have them take effect at this location.
# You can modify the rules from these initially generated values to suit your own policies
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

[/src/CmsEngine.{Data/Migrations,Ui/Areas/Identity/Pages}/**]
generated_code = true
dotnet_analyzer_diagnostic.severity = none

[*.cs]

csharp_style_namespace_declarations = file_scoped:warning
Expand Down Expand Up @@ -188,29 +193,29 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,4 @@ package-lock.json
*.Development.json
[Rr]eadme.md
CmsEngine.Ui/_logs
global.json
global.json
9 changes: 5 additions & 4 deletions CmsEngine.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution files", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
global.json = global.json
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmsEngine.Core", "src\CmsEngine.Core\CmsEngine.Core.csproj", "{0DCFFE7F-6BF0-40F5-B8ED-B0A213B415C4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CmsEngine.Core", "src\CmsEngine.Core\CmsEngine.Core.csproj", "{0DCFFE7F-6BF0-40F5-B8ED-B0A213B415C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmsEngine.Data", "src\CmsEngine.Data\CmsEngine.Data.csproj", "{9D472F52-7D5D-4956-9DE2-DB5546262DAB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CmsEngine.Data", "src\CmsEngine.Data\CmsEngine.Data.csproj", "{9D472F52-7D5D-4956-9DE2-DB5546262DAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmsEngine.Application", "src\CmsEngine.Application\CmsEngine.Application.csproj", "{081C9102-37CB-4873-97D2-0A5063FFA4A3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CmsEngine.Application", "src\CmsEngine.Application\CmsEngine.Application.csproj", "{081C9102-37CB-4873-97D2-0A5063FFA4A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmsEngine.Ui", "src\CmsEngine.Ui\CmsEngine.Ui.csproj", "{AEED8BDE-0C8A-43BC-91B8-77B967511921}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CmsEngine.Ui", "src\CmsEngine.Ui\CmsEngine.Ui.csproj", "{AEED8BDE-0C8A-43BC-91B8-77B967511921}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "6.0.403"
}
}
3 changes: 2 additions & 1 deletion src/CmsEngine.Application/CmsEngine.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MailKit" Version="3.1.1" />
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="MailKit" Version="3.4.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
Expand Down
10 changes: 5 additions & 5 deletions src/CmsEngine.Application/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace CmsEngine.Application.Extensions;

public static class EnumerableExtensions
{
public static Expression<Func<T, bool>> GetSearchExpression<T>(this IEnumerable<T> element, string searchValue, IEnumerable<PropertyInfo> properties)
public static Expression<Func<T, bool>>? GetSearchExpression<T>(this IEnumerable<T> element, string searchValue, IEnumerable<PropertyInfo> properties)
{
var expressionFilter = new List<ExpressionFilter>();

Expand All @@ -19,22 +19,22 @@ public static Expression<Func<T, bool>> GetSearchExpression<T>(this IEnumerable<
return ExpressionBuilder.GetExpression<T>(expressionFilter, LogicalOperator.Or);
}

public static IEnumerable<SelectListItem> PopulateSelectList<T>(this IEnumerable<T> items, IEnumerable<string> selectedItems = null) where T : BaseViewModel
public static IEnumerable<SelectListItem> PopulateSelectList<T>(this IEnumerable<T> items, IEnumerable<string>? selectedItems = null) where T : BaseViewModel
{
return items.Select(x => new SelectListItem
{
Text = x.GetType().GetProperty("Name").GetValue(x).ToString(),
Text = x.GetType().GetProperty("Name")?.GetValue(x)?.ToString() ?? string.Empty,
Value = x.VanityId.ToString(),
Disabled = false,
Selected = selectedItems?.Contains(x.VanityId.ToString()) ?? false
}).OrderBy(o => o.Text);
}

public static IEnumerable<CheckboxEditModel> PopulateCheckboxList<T>(this IEnumerable<T> items, IEnumerable<string> selectedItems = null) where T : BaseViewModel
public static IEnumerable<CheckboxEditModel> PopulateCheckboxList<T>(this IEnumerable<T> items, IEnumerable<string>? selectedItems = null) where T : BaseViewModel
{
return items.Select(x => new CheckboxEditModel
{
Label = x.GetType().GetProperty("Name").GetValue(x).ToString(),
Label = x.GetType().GetProperty("Name")?.GetValue(x)?.ToString() ?? string.Empty,
Value = x.VanityId.ToString(),
Enabled = true,
Selected = selectedItems?.Contains(x.VanityId.ToString()) ?? false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static IEnumerable<CategoryTableViewModel> MapToTableViewModel(this IEnum
/// </summary>
/// <param name="categories"></param>
/// <returns></returns>
public static IEnumerable<CategoryViewModel> MapToViewModel(this IEnumerable<Category> categories)
public static IEnumerable<CategoryViewModel> MapToViewModel(this IEnumerable<Category> categories, string dateFormat)
{
var viewModel = new List<CategoryViewModel>();

Expand All @@ -95,7 +95,7 @@ public static IEnumerable<CategoryViewModel> MapToViewModel(this IEnumerable<Cat
Name = item.Name,
Description = item.Description,
Slug = item.Slug,
Posts = item.PostCategories.Select(x => x.Post).MapToViewModel()
Posts = item.PostCategories?.Select(x => x.Post).MapToViewModel(dateFormat)
});
}

Expand Down Expand Up @@ -152,7 +152,7 @@ public static IEnumerable<CategoryViewModel> MapToViewModelWithPostCount(this IE
/// </summary>
/// <param name="categories"></param>
/// <returns></returns>
public static IEnumerable<CategoryViewModel> MapToViewModelWithPost(this IEnumerable<Category> categories)
public static IEnumerable<CategoryViewModel> MapToViewModelWithPost(this IEnumerable<Category> categories, string dateFormat)
{
var viewModel = new List<CategoryViewModel>();

Expand All @@ -169,7 +169,7 @@ public static IEnumerable<CategoryViewModel> MapToViewModelWithPost(this IEnumer
Title = p.Title,
Description = p.Description,
Slug = p.Slug,
PublishedOn = p.PublishedOn.ToShortDateString()
PublishedOn = p.PublishedOn.ToString(dateFormat)
})
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/CmsEngine.Application/Extensions/Mapper/PageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static IEnumerable<PageTableViewModel> MapToTableViewModel(this IEnumerab
Title = item.Title,
Description = item.Description,
Slug = item.Slug,
PublishedOn = item.PublishedOn.ToString(),
PublishedOn = item.PublishedOn.ToString("yyyy-MM-dd HH:mm:ss"),
Status = item.Status,
Author = item.ApplicationUsers.MapToViewModelSimple().Single()
});
Expand All @@ -124,7 +124,7 @@ public static IEnumerable<PageTableViewModel> MapToTableViewModel(this IEnumerab
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static PageViewModel MapToViewModel(this Page item)
public static PageViewModel MapToViewModel(this Page item, string dateFormat)
{
return new PageViewModel
{
Expand All @@ -134,7 +134,7 @@ public static PageViewModel MapToViewModel(this Page item)
Description = item.Description,
DocumentContent = item.DocumentContent,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Author = item.ApplicationUsers.MapToViewModelSimple().Single()
};
}
Expand All @@ -144,7 +144,7 @@ public static PageViewModel MapToViewModel(this Page item)
/// </summary>
/// <param name="pages"></param>
/// <returns></returns>
public static IEnumerable<PageViewModel> MapToViewModel(this IEnumerable<Page> pages)
public static IEnumerable<PageViewModel> MapToViewModel(this IEnumerable<Page> pages, string dateFormat)
{
var editModels = new List<PageViewModel>();

Expand All @@ -159,7 +159,7 @@ public static IEnumerable<PageViewModel> MapToViewModel(this IEnumerable<Page> p
Description = item.Description,
DocumentContent = item.DocumentContent,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Status = item.Status
});
}
Expand Down
28 changes: 14 additions & 14 deletions src/CmsEngine.Application/Extensions/Mapper/PostExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static IEnumerable<PostTableViewModel> MapToTableViewModel(this IEnumerab
Title = item.Title,
Description = item.Description,
Slug = item.Slug,
PublishedOn = item.PublishedOn.ToString(),
PublishedOn = item.PublishedOn.ToString("yyyy-MM-dd HH:mm:ss"),
Status = item.Status,
Author = item.ApplicationUsers.MapToViewModelSimple().Single()
});
Expand All @@ -126,7 +126,7 @@ public static IEnumerable<PostTableViewModel> MapToTableViewModel(this IEnumerab
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static PostViewModel MapToViewModel(this Post item)
public static PostViewModel MapToViewModel(this Post item, string dateFormat)
{
return new PostViewModel
{
Expand All @@ -136,7 +136,7 @@ public static PostViewModel MapToViewModel(this Post item)
Description = item.Description,
DocumentContent = item.DocumentContent,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Categories = item.Categories.MapToViewModelSimple(),
Author = item.ApplicationUsers.MapToViewModelSimple().Single()
};
Expand All @@ -147,7 +147,7 @@ public static PostViewModel MapToViewModel(this Post item)
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static IEnumerable<PostViewModel> MapToViewModel(this IEnumerable<Post> posts)
public static IEnumerable<PostViewModel> MapToViewModel(this IEnumerable<Post> posts, string dateFormat)
{
var viewModels = new List<PostViewModel>();

Expand All @@ -162,7 +162,7 @@ public static IEnumerable<PostViewModel> MapToViewModel(this IEnumerable<Post> p
Description = item.Description,
DocumentContent = item.DocumentContent,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Status = item.Status
});
}
Expand All @@ -175,7 +175,7 @@ public static IEnumerable<PostViewModel> MapToViewModel(this IEnumerable<Post> p
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static IEnumerable<PostViewModel> MapToViewModelWithCategories(this IEnumerable<Post> posts)
public static IEnumerable<PostViewModel> MapToViewModelWithCategories(this IEnumerable<Post> posts, string dateFormat)
{
var viewModels = new List<PostViewModel>();

Expand All @@ -190,9 +190,9 @@ public static IEnumerable<PostViewModel> MapToViewModelWithCategories(this IEnum
Description = item.Description,
DocumentContent = item.DocumentContent,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Status = item.Status,
Categories = item.PostCategories.Select(x => x.Category).MapToViewModel()
Categories = item.PostCategories.Select(x => x.Category).MapToViewModel(dateFormat)
});
}

Expand All @@ -204,7 +204,7 @@ public static IEnumerable<PostViewModel> MapToViewModelWithCategories(this IEnum
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static IEnumerable<PostViewModel> MapToViewModelWithTags(this IEnumerable<Post> posts)
public static IEnumerable<PostViewModel> MapToViewModelWithTags(this IEnumerable<Post> posts, string dateFormat)
{
var viewModels = new List<PostViewModel>();

Expand All @@ -219,7 +219,7 @@ public static IEnumerable<PostViewModel> MapToViewModelWithTags(this IEnumerable
Description = item.Description,
DocumentContent = item.DocumentContent,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Status = item.Status,
Tags = item.PostTags.Select(x => x.Tag).MapToViewModel()
});
Expand All @@ -233,7 +233,7 @@ public static IEnumerable<PostViewModel> MapToViewModelWithTags(this IEnumerable
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static IEnumerable<PostViewModel> MapToViewModelForPartialView(this IEnumerable<Post> posts)
public static IEnumerable<PostViewModel> MapToViewModelForPartialView(this IEnumerable<Post> posts, string dateFormat)
{
var viewModels = new List<PostViewModel>();

Expand All @@ -246,7 +246,7 @@ public static IEnumerable<PostViewModel> MapToViewModelForPartialView(this IEnum
Slug = item.Slug,
Description = item.Description,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Categories = item.Categories.MapToViewModelSimple(),
Author = item.ApplicationUsers.MapToViewModelSimple().Single()
});
Expand All @@ -260,7 +260,7 @@ public static IEnumerable<PostViewModel> MapToViewModelForPartialView(this IEnum
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static IEnumerable<PostViewModel> MapToViewModelForPartialViewForTags(this IEnumerable<Post> posts)
public static IEnumerable<PostViewModel> MapToViewModelForPartialViewForTags(this IEnumerable<Post> posts, string dateFormat)
{
var viewModels = new List<PostViewModel>();

Expand All @@ -273,7 +273,7 @@ public static IEnumerable<PostViewModel> MapToViewModelForPartialViewForTags(thi
Slug = item.Slug,
Description = item.Description,
HeaderImage = item.HeaderImage,
PublishedOn = item.PublishedOn.ToShortDateString(),
PublishedOn = item.PublishedOn.ToString(dateFormat),
Categories = item.Categories.MapToViewModelSimple(),
Tags = item.Tags.MapToViewModelSimple(),
Author = item.ApplicationUsers.MapToViewModelSimple().Single()
Expand Down
3 changes: 2 additions & 1 deletion src/CmsEngine.Application/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
global using System.Drawing.Imaging;
global using System.Globalization;
global using System.Linq.Expressions;
global using System.Net;
global using System.Reflection;
global using System.Runtime.Versioning;
global using System.Text.Encodings.Web;
global using System.Xml.Linq;
global using Ardalis.GuardClauses;
global using CmsEngine.Application.Attributes;
global using CmsEngine.Application.Extensions;
global using CmsEngine.Application.Extensions.Mapper;
Expand Down
11 changes: 8 additions & 3 deletions src/CmsEngine.Application/Helpers/DataTableHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ public static DataTableViewModel BuildDataTable(IEnumerable<IViewModel> listItem
private static string PrepareProperty(IViewModel item, PropertyInfo property)
{
GeneralStatus generalStatus;
var value = item.GetType().GetProperty(property.Name).GetValue(item);
var value = item.GetType().GetProperty(property.Name)?.GetValue(item);

if (value == null)
{
return string.Empty;
}

switch (property.PropertyType.Name)
{
Expand All @@ -63,12 +68,12 @@ private static string PrepareProperty(IViewModel item, PropertyInfo property)
return $"<span class=\"badge badge-{generalStatus.ToString().ToLowerInvariant()}\">{documentStatus.ToEnum<DocumentStatus>().GetName()}</status-label>";
case "UserViewModel":
var author = (UserViewModel)value;
return HtmlEncoder.Default.Encode(author?.FullName ?? "");
return HtmlEncoder.Default.Encode(author?.FullName ?? string.Empty);
case "Boolean":
generalStatus = (bool)value ? GeneralStatus.Success : GeneralStatus.Danger;
return $"<span class=\"badge badge-{generalStatus.ToString().ToLowerInvariant()}\">{((bool)value).ToYesNo().ToUpper()}</status-label>";
default:
return HtmlEncoder.Default.Encode(value?.ToString() ?? "");
return HtmlEncoder.Default.Encode(value?.ToString() ?? string.Empty);
}
}
}
Loading

0 comments on commit 63d5f1f

Please sign in to comment.