Compare commits

..

No commits in common. "3054d09e335d5472b38534ece86b9c5ba1e776ca" and "f58cacbeaa7c4b0c5f6928e8299e35af20e1dc23" have entirely different histories.

1 changed files with 17 additions and 16 deletions

View File

@ -14,14 +14,16 @@ namespace AyCode.Entities.Profiles
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
public Guid? UserMediaId { get; set; }
[Required]
public Guid AddressId { get; set; }
[ForeignKey(nameof(AddressId))]
public virtual TAddress Address { get; set; }
[Required] public Guid AddressId { get; set; }
[ForeignKey(nameof(AddressId))] public virtual TAddress Address { get; set; }
[Required] public string Name { get; set; }
[Required]
public string Name { get; set; }
public string? FullName => GetFullName("ENG");
public string? FirstName { get; set; }
public string? LastName { get; set; }
@ -31,14 +33,12 @@ namespace AyCode.Entities.Profiles
public string? Description { get; set; }
public string? ThumbnailUrl { get; set; }
public string? ThumbnailUrl { get ; set; }
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
protected AcProfile()
{
}
protected AcProfile() { }
protected AcProfile(Guid id) : this()
{
@ -58,16 +58,17 @@ namespace AyCode.Entities.Profiles
AddressId = address.Id;
}
public string GetFullName(string lang = "ENG") => GetFullName(FirstName, LastName, lang);
public string? GetFullName(string lang = "ENG") => GetFullName(FirstName, LastName, lang);
public static string GetFullName(string? firstName, string? lastName, string? lang = "ENG")
public static string? GetFullName(string? firstName, string? lastName, string? lang = "ENG")
{
string fullName;
if (firstName.IsNullOrWhiteSpace()) return lastName;
if (lang == "ENG") fullName = firstName + " " + lastName;
else fullName = lastName + " " + firstName;
if(lastName.IsNullOrWhiteSpace()) return firstName;
return (fullName.IsNullOrWhiteSpace() ? "Missing name!" : fullName.Trim());
if (lang == "ENG") return firstName + " " + lastName;
return lastName + " " + firstName;
}
}
}