Company, Profile, Address improvements
This commit is contained in:
parent
80412a8469
commit
d82f6b9dc3
|
|
@ -20,4 +20,22 @@ public abstract class AcAddress : IAcAddress
|
|||
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
||||
protected AcAddress()
|
||||
{ }
|
||||
|
||||
protected AcAddress(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
protected AcAddress(Guid id, string? addressText) : this(id, null, null, addressText)
|
||||
{ }
|
||||
|
||||
protected AcAddress(Guid id, double? latitude, double? longitude, string? addressText) : this(id)
|
||||
{
|
||||
Latitude = latitude;
|
||||
Longitude = longitude;
|
||||
AddressText = addressText;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,21 +2,16 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using AyCode.Core.Extensions;
|
||||
using AyCode.Entities.Addresses;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Utils.Extensions;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace AyCode.Entities.Profiles
|
||||
{
|
||||
[Table("Profile")]
|
||||
public abstract class AcProfile<TAddress> : IAcProfile<TAddress> where TAddress : class, IAcAddress
|
||||
{
|
||||
protected AcProfile() { }
|
||||
|
||||
protected AcProfile(Guid id) : this()
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public Guid Id { get; set; }
|
||||
public Guid? UserMediaId { get; set; }
|
||||
|
|
@ -43,6 +38,26 @@ namespace AyCode.Entities.Profiles
|
|||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
||||
protected AcProfile() { }
|
||||
|
||||
protected AcProfile(Guid id) : this()
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
protected AcProfile(Guid id, string name) : this(id)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public void SetAddress(TAddress address)
|
||||
{
|
||||
if (address.Id.IsNullOrEmpty()) address.Id = Guid.NewGuid();
|
||||
|
||||
Address = address;
|
||||
AddressId = address.Id;
|
||||
}
|
||||
|
||||
public string? GetFullName(string lang = "ENG") => GetFullName(FirstName, LastName, lang);
|
||||
|
||||
public static string? GetFullName(string? firstName, string? lastName, string? lang = "ENG")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
using AyCode.Interfaces.Users;
|
||||
using AyCode.Utils.Extensions;
|
||||
|
||||
namespace AyCode.Entities.ServiceProviders
|
||||
{
|
||||
|
|
@ -20,8 +21,7 @@ namespace AyCode.Entities.ServiceProviders
|
|||
public Guid OwnerId { get; set; }
|
||||
|
||||
public Guid ProfileId { get; set; }
|
||||
[NotMapped] //COMPANY_RENAME - J.
|
||||
public TProfile Profile { get; set; }
|
||||
public virtual TProfile Profile { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
|
|
@ -60,5 +60,13 @@ namespace AyCode.Entities.ServiceProviders
|
|||
AffiliateId = affiliateId;
|
||||
CommissionPercent = commissionPercent;
|
||||
}
|
||||
|
||||
public void SetProfile(TProfile profile)
|
||||
{
|
||||
if (profile.Id.IsNullOrEmpty()) profile.Id = Guid.NewGuid();
|
||||
|
||||
Profile = profile;
|
||||
ProfileId = profile.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue