basszódj meg!!!!!!!!
This commit is contained in:
parent
6275a35937
commit
8b94dae965
|
|
@ -6,24 +6,39 @@ using AyCode.Entities.Addresses;
|
|||
using AyCode.Entities.Profiles;
|
||||
using AyCode.Entities.Users;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Messages;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
using AyCode.Interfaces.Users;
|
||||
using AyCode.Interfaces.Users.Dtos;
|
||||
using AyCode.Models.Users;
|
||||
|
||||
namespace AyCode.Database.Tests.Users
|
||||
{
|
||||
public abstract class AcUserDalTestBase<TDal, TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
|
||||
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
|
||||
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToServiceProvider, TProfileAddress, TEmailMessage>
|
||||
where TUser : class, IAcUser<TProfile, TCompany, TUserToServiceProvider, TProfileAddress>
|
||||
where TProfile : class, IAcProfile<TProfileAddress>
|
||||
where TProfileAddress : class, IAcAddress
|
||||
public abstract class AcUserDalTestBase<TDal, TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToCompany, TAddress, TEmailMessage> : AcDatabaseTestModelBase<TDal, TDbContext>
|
||||
where TDal : AcUserDalBase<TDbContext, TUser, TProfile, TUserToken, TCompany, TUserToCompany, TAddress, TEmailMessage>
|
||||
where TDbContext : AcDbContextBase, IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUserToCompany, TAddress, TEmailMessage>
|
||||
where TUser : class, IAcUser<TProfile, TCompany, TUserToCompany, TAddress>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
where TUserToken : class, IAcUserTokenBase
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToServiceProvider : class, IAcUserToCompanyBase
|
||||
where TUserToCompany : class, IAcUserToCompanyBase
|
||||
where TEmailMessage : class, IAcEmailMessageBase
|
||||
{
|
||||
public class UserModelDtoDetailTest : AcUserModelDtoDetailBase<TUser, TProfile, TCompany, TUserToCompany, TAddress>
|
||||
{
|
||||
public UserModelDtoDetailTest() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public UserModelDtoDetailTest(IAcUserDtoDetailBase<TProfile, TCompany, TUserToCompany, TAddress> user) : base(user)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
public virtual void AcBase_GetUserById_ReturnsUser_WhenUserExists(string userIdString) => AcBase_GetUserById(userIdString);
|
||||
|
||||
|
|
@ -59,6 +74,19 @@ namespace AyCode.Database.Tests.Users
|
|||
return user;
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
public virtual void AcBase_GetUserModelDtoDetailById_ReturnsUser_WhenUserExists(string userIdString)
|
||||
{
|
||||
var userId = Guid.Parse(userIdString);
|
||||
var userModelDtoDetail = Dal.GetUserModelDtoById<UserModelDtoDetailTest>(userId, false);
|
||||
|
||||
Assert.IsNotNull(userModelDtoDetail, "User is null");
|
||||
Assert.IsNotNull(userModelDtoDetail.ProfileDto, "Profile is null");
|
||||
Assert.IsNotNull(userModelDtoDetail.ProfileDto.Address, "Profile.Address is null");
|
||||
|
||||
Assert.AreEqual(userId, userModelDtoDetail.Id);
|
||||
}
|
||||
|
||||
protected async Task<TUser> AcBase_GetUserByEmailAsync_ReturnsUser_WhenUserExists(string email)
|
||||
{
|
||||
TUser? user = null;
|
||||
|
|
@ -104,7 +132,7 @@ namespace AyCode.Database.Tests.Users
|
|||
profile.Id = profileId;;
|
||||
profile.Name = "Add user test name";
|
||||
|
||||
var address = Activator.CreateInstance<TProfileAddress>();
|
||||
var address = Activator.CreateInstance<TAddress>();
|
||||
address.Id = addressId;
|
||||
address.Latitude = 5362.2341652256;
|
||||
address.Longitude = 5362.2341333317;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ using AyCode.Interfaces.Addresses;
|
|||
using AyCode.Interfaces.Messages;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
|
||||
namespace AyCode.Database.DataLayers.Users
|
||||
{
|
||||
|
|
@ -28,7 +30,7 @@ namespace AyCode.Database.DataLayers.Users
|
|||
where TUserToken : class, IAcUserTokenBase
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToCompany : class, IAcUserToCompanyBase
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
where TEmailMessage : class, IAcEmailMessageBase
|
||||
{
|
||||
public TUser? GetUserById(Guid userId, bool onlyConfirmed) => Session(x => x.GetUserById(userId, onlyConfirmed));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using AyCode.Database.DbSets.Messages;
|
|||
using AyCode.Database.DbSets.Profiles;
|
||||
using AyCode.Database.DbSets.Users;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Messages;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
|
|
@ -18,7 +19,7 @@ public interface IAcUserDbContextBase<TUser, TProfile, TUserToken, TCompany, TUs
|
|||
where TUserToken : class, IAcUserTokenBase
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToServiceProvider : class, IAcUserToCompanyBase
|
||||
where TProfileAddress : class, IAcAddress
|
||||
where TProfileAddress : class, IAcAddressDtoBase
|
||||
where TEmailMessage : class, IAcEmailMessageBase
|
||||
{
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Users;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AyCode.Database.DbSets.Addresses;
|
||||
|
||||
public interface IAcAddressDbSetBase<TAddress> where TAddress : class, IAcAddress
|
||||
public interface IAcAddressDbSetBase<TAddress> where TAddress : class, IAcAddressDtoBase
|
||||
{
|
||||
DbSet<TAddress> Addresses { get; set; }
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ using AyCode.Interfaces.Addresses;
|
|||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
|
||||
namespace AyCode.Database.DbSets.Profiles;
|
||||
|
||||
|
|
@ -20,7 +21,7 @@ public static class AcProfileDbSetExtensions
|
|||
|
||||
public static bool RemoveProfile<TProfile, TAddress>(this IAcProfileDbSetBase<TProfile, TAddress> ctx, TProfile profile)
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{
|
||||
var address = ctx.Addresses.FirstOrDefault(x => x.Id == profile.AddressId);
|
||||
if (address != null) ctx.Addresses.Remove(address);
|
||||
|
|
@ -30,7 +31,7 @@ public static class AcProfileDbSetExtensions
|
|||
|
||||
public static bool RemoveProfile<TProfile, TAddress>(this IAcProfileDbSetBase<TProfile, TAddress> ctx, Guid profileId)
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{
|
||||
var profile = ctx.GetProfileById(profileId);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using AyCode.Database.DbSets.Addresses;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.Users;
|
||||
|
|
@ -14,6 +15,6 @@ public interface IAcProfileDbSetBase<TProfile> where TProfile : class, IAcProfil
|
|||
|
||||
public interface IAcProfileDbSetBase<TProfile, TAddress> : IAcProfileDbSetBase<TProfile>, IAcAddressDbSetBase<TAddress>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ using AyCode.Database.Extensions;
|
|||
using AyCode.Entities;
|
||||
using AyCode.Entities.Users;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
|
|
@ -71,7 +72,7 @@ public static class AcUserDbSetExtensions
|
|||
public static bool RemoveUser<TUser, TProfile, TAddress>(this IAcUserDbSetBase<TUser, TProfile, TAddress> ctx, TUser user)
|
||||
where TUser : class, IAcUser<TProfile, TAddress>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{
|
||||
ctx.RemoveProfile(user.ProfileId);
|
||||
|
||||
|
|
@ -81,7 +82,7 @@ public static class AcUserDbSetExtensions
|
|||
public static bool RemoveUser<TUser, TProfile, TAddress>(this IAcUserDbSetBase<TUser, TProfile, TAddress> ctx, Guid userId)
|
||||
where TUser : class, IAcUser<TProfile, TAddress>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{
|
||||
var user = ctx.GetUserById(userId, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using AyCode.Database.DbSets.Companies;
|
||||
using AyCode.Database.DbSets.Profiles;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
using AyCode.Interfaces.Users;
|
||||
|
|
@ -17,14 +18,14 @@ public interface IAcUserDbSetBase<TUser> where TUser : class, IAcUserBase
|
|||
public interface IAcUserDbSetBase<TUser, TProfile, TAddress> : IAcUserDbSetBase<TUser>, IAcProfileDbSetBase<TProfile, TAddress>
|
||||
where TUser : class, IAcUserBase
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUserDbSetBase<TUser, TProfile, TCompany, TAddress> : IAcUserDbSetBase<TUser, TProfile, TAddress>, IAcCompanyDbSetBase<TCompany>
|
||||
where TUser : class, IAcUserBase
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUserDbSetBase<TUser, TProfile, TCompany, TUserToCompany, TAddress> : IAcUserDbSetBase<TUser, TProfile, TCompany, TAddress>
|
||||
|
|
@ -32,5 +33,5 @@ public interface IAcUserDbSetBase<TUser, TProfile, TCompany, TUserToCompany, TAd
|
|||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToCompany : class, IAcUserToCompanyBase
|
||||
where TAddress : class, IAcAddress
|
||||
where TAddress : class, IAcAddressDtoBase
|
||||
{ }
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using System.Formats.Tar;
|
||||
using System.Net;
|
||||
|
||||
namespace AyCode.Interfaces.Addresses;
|
||||
|
||||
public interface IAcAddressRelation<TAddress> : IAcAddressForeignKey where TAddress : IAcAddress
|
||||
public interface IAcAddressRelation<TAddress> : IAcAddressForeignKey where TAddress : IAcAddressDtoBase
|
||||
{
|
||||
public TAddress Address { get; set; }
|
||||
}
|
||||
|
|
@ -3,9 +3,14 @@ using AyCode.Interfaces.Entities;
|
|||
using AyCode.Interfaces.MediaInfo;
|
||||
using AyCode.Interfaces.Users;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
|
||||
namespace AyCode.Interfaces.Profiles.Dtos;
|
||||
|
||||
public interface IAcProfileDtoBase<TAddress> : IAcProfileDtoBase, IAcAddressRelation<TAddress> where TAddress : IAcAddressDtoBase
|
||||
{
|
||||
}
|
||||
|
||||
public interface IAcProfileDtoBase : IEntityGuid, IAcProfileName, IMediaInfo, IAcAddressForeignKey//, IAcEmailAddress
|
||||
{
|
||||
[MaxLength(150)]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
|
||||
namespace AyCode.Interfaces.Profiles;
|
||||
|
||||
public interface IAcProfile<TAddress> : IAcProfileDtoBase, ITimeStampInfo, IAcAddressRelation<TAddress> where TAddress : IAcAddress
|
||||
public interface IAcProfile<TAddress> : IAcProfileDtoBase<TAddress>, ITimeStampInfo where TAddress : IAcAddressDtoBase
|
||||
{
|
||||
public string? GetFullName(string lang = "ENG");
|
||||
}
|
||||
|
|
@ -1,17 +1,34 @@
|
|||
using AyCode.Interfaces.Profiles;
|
||||
using System.Diagnostics.Contracts;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
|
||||
namespace AyCode.Interfaces.Users.Dtos;
|
||||
|
||||
public interface IAcUserDtoBase<TProfile, TAddress> : IAcUserDtoMinBase<TProfile>
|
||||
where TProfile : IAcProfile<TAddress>
|
||||
where TAddress : IAcAddress
|
||||
public interface IAcUserDtoBase : IAcUserDtoMinBase
|
||||
{}
|
||||
|
||||
public interface IAcUserDtoBase<TProfile> : IAcUserDtoMinBase<TProfile>, IAcUserDtoBase
|
||||
where TProfile : IAcProfileDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUserDtoBase<TProfile, TCompany, TUserToCompany, TAddress> : IAcUserDtoBase<TProfile, TAddress>, IAcCompanyRelation<TCompany, TUserToCompany>
|
||||
where TProfile : IAcProfile<TAddress>
|
||||
//public interface IAcUserDtoBase<TProfile, TAddress> : IAcUserDtoBase<TProfile>
|
||||
// where TProfile : IAcProfileDtoBase<TAddress>
|
||||
// where TAddress : IAcAddressDtoBase
|
||||
//{ }
|
||||
|
||||
public interface IAcUserDtoBase<TProfile, TCompany, TUserToCompany> : IAcUserDtoBase<TProfile>, IAcCompanyRelation<TCompany, TUserToCompany>
|
||||
where TProfile : IAcProfileDtoBase
|
||||
where TCompany : IAcCompanyBase
|
||||
where TUserToCompany : IAcUserToCompanyBase
|
||||
where TAddress : IAcAddress
|
||||
{ }
|
||||
{ }
|
||||
|
||||
//public interface IAcUserDtoBase<TProfile, TCompany, TUserToCompany, TAddress> : IAcUserDtoBase<TProfile, TCompany, TUserToCompany>, IAcUserDtoBase<TProfile, TAddress>
|
||||
// where TProfile : IAcProfileDtoBase<TAddress>
|
||||
// where TCompany : IAcCompanyBase
|
||||
// where TUserToCompany : IAcUserToCompanyBase
|
||||
// where TAddress : IAcAddressDtoBase
|
||||
//{ }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,32 @@
|
|||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
|
||||
namespace AyCode.Interfaces.Users.Dtos;
|
||||
|
||||
public interface IAcUserDtoDetailBase<TProfile, TAddress> : IAcUserBase, IAcUserDtoBase<TProfile, TAddress>
|
||||
where TProfile : IAcProfile<TAddress>
|
||||
where TAddress : IAcAddress
|
||||
public interface IAcUserDtoDetailBase : IAcUserBase, IAcUserDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUserDtoDetailBase<TProfile, TCompany, TUserToCompany, TAddress> : IAcUserDtoDetailBase<TProfile, TAddress>, IAcUserDtoBase<TProfile, TCompany, TUserToCompany, TAddress>
|
||||
where TProfile : IAcProfile<TAddress>
|
||||
public interface IAcUserDtoDetailBase<TProfile> : IAcUserDtoDetailBase, IAcUserDtoBase<TProfile>
|
||||
where TProfile : IAcProfileDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUserDtoDetailBase<TProfile, TAddress> : IAcUserDtoDetailBase<TProfile>//, IAcUserDtoBase<TProfile, TAddress>
|
||||
where TProfile : IAcProfileDtoBase<TAddress>
|
||||
where TAddress : IAcAddressDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUserDtoDetailBase<TProfile, TCompany, TUserToCompany> : IAcUserDtoDetailBase<TProfile>, IAcUserDtoBase<TProfile, TCompany, TUserToCompany>
|
||||
where TProfile : IAcProfileDtoBase
|
||||
where TCompany : IAcCompanyBase
|
||||
where TUserToCompany : IAcUserToCompanyBase
|
||||
where TAddress : IAcAddress
|
||||
{ }
|
||||
|
||||
public interface IAcUserDtoDetailBase<TProfile, TCompany, TUserToCompany, TAddress> : IAcUserDtoDetailBase<TProfile, TAddress>, IAcUserDtoBase<TProfile, TCompany, TUserToCompany>
|
||||
where TProfile : IAcProfileDtoBase<TAddress>
|
||||
where TCompany : IAcCompanyBase
|
||||
where TUserToCompany : IAcUserToCompanyBase
|
||||
where TAddress : IAcAddressDtoBase
|
||||
{ }
|
||||
|
|
@ -5,7 +5,12 @@ using AyCode.Interfaces.Profiles.Dtos;
|
|||
|
||||
namespace AyCode.Interfaces.Users.Dtos;
|
||||
|
||||
public interface IAcUserDtoMinBase<TProfile> : IEntityGuid, IAcProfileRelation<TProfile> where TProfile : IAcProfileDtoBase
|
||||
public interface IAcUserDtoMinBase : IEntityGuid
|
||||
{
|
||||
public Guid AffiliateId { get; set; }
|
||||
}
|
||||
|
||||
public interface IAcUserDtoMinBase<TProfile> : IAcUserDtoMinBase, IAcProfileRelation<TProfile> where TProfile : IAcProfileDtoBase
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
using AyCode.Interfaces.Users.Dtos;
|
||||
|
|
@ -8,12 +9,12 @@ namespace AyCode.Interfaces.Users;
|
|||
|
||||
public interface IAcUser<TProfile, TAddress> : IAcUserDtoDetailBase<TProfile, TAddress>
|
||||
where TProfile : IAcProfile<TAddress>
|
||||
where TAddress : IAcAddress
|
||||
where TAddress : IAcAddressDtoBase
|
||||
{ }
|
||||
|
||||
public interface IAcUser<TProfile, TCompany, TUserToCompany, TAddress> : IAcUser<TProfile, TAddress>, IAcUserDtoDetailBase<TProfile, TCompany, TUserToCompany, TAddress>
|
||||
where TProfile : IAcProfile<TAddress>
|
||||
where TCompany : IAcCompanyBase
|
||||
where TUserToCompany : IAcUserToCompanyBase
|
||||
where TAddress : IAcAddress
|
||||
where TAddress : IAcAddressDtoBase
|
||||
{ }
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
|
|
@ -7,23 +8,23 @@ using AyCode.Interfaces.Users.Dtos;
|
|||
|
||||
namespace AyCode.Models.Users;
|
||||
|
||||
public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TAddress> : AcUserModelDtoMinBase<TUserDto, TProfile, TProfileDto, TAddress>, IAcCompanyRelation<TCompany, TUserToServiceProvider>
|
||||
where TUserDto : class, IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TAddress>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
public abstract class AcUserModelDtoBase<TUserDto, TProfileDto, TCompany, TUserToCompany> : AcUserModelDtoMinBase<TUserDto, TProfileDto>, IAcCompanyRelation<TCompany, TUserToCompany>
|
||||
where TUserDto : class, IAcUserDtoBase
|
||||
where TProfileDto : class, IAcProfileDtoBase
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToServiceProvider : class, IAcUserToCompanyBase
|
||||
where TAddress : class, IAcAddress
|
||||
where TUserToCompany : class, IAcUserToCompanyBase
|
||||
//where TAddressDto : class, IAcAddressDtoBase
|
||||
{
|
||||
public List<TCompany> ServiceProviders { get; set; }
|
||||
public List<TUserToServiceProvider> UserToServiceProviders { get; set; }
|
||||
public List<TUserToCompany> UserToServiceProviders { get; set; }
|
||||
|
||||
|
||||
protected AcUserModelDtoBase() {}
|
||||
protected AcUserModelDtoBase(IAcUserDtoBase<TProfile, TCompany, TUserToServiceProvider, TAddress> user) : base(user)
|
||||
protected AcUserModelDtoBase(IAcUserDtoBase<TProfileDto, TCompany, TUserToCompany> user) : base(user)
|
||||
{
|
||||
Profile.AddressId = user.Profile.AddressId;
|
||||
ProfileDto.AddressId = user.Profile.AddressId;
|
||||
UserDto.AffiliateId = user.AffiliateId;
|
||||
|
||||
if (user.ServiceProviders.Count == 0) return;
|
||||
|
||||
//így proxy error lesz... - J.
|
||||
|
|
@ -31,7 +32,7 @@ public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TCompa
|
|||
//UserToServiceProviders = new List<TUserToServiceProvider>(user.UserToServiceProviders);
|
||||
|
||||
ServiceProviders = new List<TCompany>(user.ServiceProviders.Count);
|
||||
UserToServiceProviders = new List<TUserToServiceProvider>(user.UserToServiceProviders.Count);
|
||||
UserToServiceProviders = new List<TUserToCompany>(user.UserToServiceProviders.Count);
|
||||
|
||||
foreach (var serviceProvider in user.ServiceProviders)
|
||||
{
|
||||
|
|
@ -46,7 +47,7 @@ public abstract class AcUserModelDtoBase<TUserDto, TProfile, TProfileDto, TCompa
|
|||
|
||||
foreach (var userToServiceProvider in user.UserToServiceProviders)
|
||||
{
|
||||
var newUserToProvider = Activator.CreateInstance<TUserToServiceProvider>();
|
||||
var newUserToProvider = Activator.CreateInstance<TUserToCompany>();
|
||||
|
||||
newUserToProvider.Id = userToServiceProvider.Id;
|
||||
newUserToProvider.UserId = userToServiceProvider.UserId;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AyCode.Interfaces.Addresses;
|
||||
using AyCode.Interfaces.Addresses.Dtos;
|
||||
using AyCode.Interfaces.Profiles;
|
||||
using AyCode.Interfaces.Profiles.Dtos;
|
||||
using AyCode.Interfaces.ServiceProviders;
|
||||
|
|
@ -7,20 +8,42 @@ using AyCode.Interfaces.Users.Dtos;
|
|||
|
||||
namespace AyCode.Models.Users;
|
||||
|
||||
public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TAddress> : AcUserModelDtoBase<TUserDtoDetail, TProfile, TProfileDto, TCompany, TUserToServiceProvider, TAddress>
|
||||
where TUserDtoDetail : class, IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TAddress>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
where TProfileDto : class, IAcProfileDtoBase
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToServiceProvider : class, IAcUserToCompanyBase
|
||||
where TAddress : class, IAcAddress
|
||||
{
|
||||
protected AcUserModelDtoDetailBase() {}
|
||||
protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfile, TCompany, TUserToServiceProvider, TAddress> user) : base(user)
|
||||
{
|
||||
Profile.Address = Activator.CreateInstance<TAddress>();
|
||||
Profile.Address.Id = user.Profile.AddressId;
|
||||
//public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TCompany, TUserToCompany, TAddressDto> : AcUserModelDtoDetailBase<TUserDtoDetail, TProfile, TProfile, TCompany, TUserToCompany, TAddressDto>
|
||||
// where TUserDtoDetail : class, IAcUserDtoDetailBase
|
||||
// where TProfile: class, IAcProfile<TAddressDto>
|
||||
// where TCompany : class, IAcCompanyBase
|
||||
// where TUserToCompany : class, IAcUserToCompanyBase
|
||||
// where TAddressDto : class, IAcAddressDtoBase
|
||||
//{
|
||||
// protected AcUserModelDtoDetailBase() : base()
|
||||
// {}
|
||||
|
||||
// protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfile, TCompany, TUserToCompany, TAddressDto> user) : base(user)
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
|
||||
public abstract class AcUserModelDtoDetailBase<TUserDtoDetail, TProfileDto, TCompany, TUserToCompany, TAddressDto> : AcUserModelDtoBase<TUserDtoDetail, TProfileDto, TCompany, TUserToCompany>
|
||||
where TUserDtoDetail : class, IAcUserDtoDetailBase
|
||||
where TProfileDto : class, IAcProfileDtoBase<TAddressDto>
|
||||
where TCompany : class, IAcCompanyBase
|
||||
where TUserToCompany : class, IAcUserToCompanyBase
|
||||
where TAddressDto : class, IAcAddressDtoBase
|
||||
{
|
||||
public TAddressDto AddressDto { get; set; }
|
||||
|
||||
protected AcUserModelDtoDetailBase() : base() {}
|
||||
|
||||
protected AcUserModelDtoDetailBase(IAcUserDtoDetailBase<TProfileDto, TCompany, TUserToCompany, TAddressDto> user) : base(user)
|
||||
{
|
||||
var address = Activator.CreateInstance<TAddressDto>();
|
||||
|
||||
address.Id = user.Profile.AddressId;
|
||||
address.AddressText = user.Profile.Address.AddressText;
|
||||
address.Latitude = user.Profile.Address.Latitude;
|
||||
address.Longitude = user.Profile.Address.Longitude;
|
||||
|
||||
ProfileDto.Address = address;
|
||||
|
||||
UserDto.EmailAddress = user.EmailAddress;
|
||||
UserDto.PhoneNumber = user.PhoneNumber;
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ using AyCode.Interfaces.Users.Dtos;
|
|||
|
||||
namespace AyCode.Models.Users;
|
||||
|
||||
public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfile, TProfileDto, TAddress> : AcModelDtoBase, IAcUserModelDtoMinBase
|
||||
where TUserDtoMin : class, IAcUserDtoMinBase<TProfile>
|
||||
where TProfile : class, IAcProfile<TAddress>
|
||||
public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfileDto> : AcModelDtoBase, IAcUserModelDtoMinBase
|
||||
where TUserDtoMin : class, IAcUserDtoMinBase
|
||||
//where TProfile : class, IAcProfileDtoBase
|
||||
where TProfileDto : class, IAcProfileDtoBase
|
||||
where TAddress : class, IAcAddress
|
||||
//where TAddress : class, IAcAddress
|
||||
{
|
||||
public TUserDtoMin UserDto { get; set;}
|
||||
public TProfile Profile { get; set; }
|
||||
public TProfileDto ProfileDto { get; set; }
|
||||
|
||||
protected AcUserModelDtoMinBase() {}
|
||||
protected AcUserModelDtoMinBase(IAcUserDtoMinBase<TProfile> user) : base(user.Id)
|
||||
protected AcUserModelDtoMinBase(IAcUserDtoMinBase<TProfileDto> user) : base(user.Id)
|
||||
{
|
||||
Id = user.Id;
|
||||
|
||||
|
|
@ -24,11 +24,11 @@ public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfile, TProfileDto,
|
|||
UserDto.Id = user.Id;
|
||||
UserDto.AffiliateId = user.AffiliateId;
|
||||
|
||||
Profile = Activator.CreateInstance<TProfile>();
|
||||
Profile.Id = user.Profile.Id;
|
||||
Profile.Name = user.Profile.Name;
|
||||
Profile.FirstName = user.Profile.FirstName;
|
||||
Profile.LastName = user.Profile.LastName;
|
||||
ProfileDto = Activator.CreateInstance<TProfileDto>();
|
||||
ProfileDto.Id = user.Profile.Id;
|
||||
ProfileDto.Name = user.Profile.Name;
|
||||
ProfileDto.FirstName = user.Profile.FirstName;
|
||||
ProfileDto.LastName = user.Profile.LastName;
|
||||
//Profile.NickName = user.Profile.NickName;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue