Skip to content

Commit

Permalink
Resolving always true warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
Psichorex committed Sep 16, 2023
1 parent 0e217ef commit 97c0804
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using OrchardCore.Html.Models;
using OrchardCore.Title.Models;
using System;
using System.Globalization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
Expand Down Expand Up @@ -78,13 +79,17 @@ private static void AlterIfPartExists<TPart>(ContentItem contentItem, Action<TPa
if (contentItem.Has<TPart>()) contentItem.Alter(action);
}

public static void ImportCommonPart(ContentItem contentItem, XElement parentElement)
private static void ImportCommonPart(ContentItem contentItem, XElement parentElement)
{
if (parentElement.Element("CommonPart") is not { } commonPart) return;

string Attribute(string name) => commonPart.Attribute(name)?.Value;

DateTime? Date(string name) => DateTime.TryParse(Attribute(name), out var date) ? date : null;
DateTime? Date(string name) => DateTime.TryParse(
Attribute(name),
CultureInfo.CurrentCulture,
DateTimeStyles.None,
out var date) ? date : null;

if (Attribute("Owner")?.Replace("/User.UserName=", string.Empty) is { } owner)
{
Expand Down

0 comments on commit 97c0804

Please sign in to comment.