Esempio n. 1
0
 private UserDTO(string firstName, string lastName, int age, IList <AccountEntity> debs, AddressEntity mainAddress, UserSourceEntity source)
 {
     FirstName = firstName;
     LastName  = lastName;
     Age       = age;
     Debs      = debs.Select(deb => new AccountDTO()
     {
         BankName = deb.BankName,
         Number   = deb.Number
     }).ToList();
     Source      = new UserSourceDTO(providerName: source.ProviderName, providerAddress: source.ProviderAddress);
     MainAddress = new AddressDTO()
     {
         City       = mainAddress.City,
         ZipCode    = mainAddress.ZipCode,
         Street     = mainAddress.Street,
         FlatNo     = mainAddress.FlatNo,
         BuildingNo = mainAddress.BuildingNo
     };
 }
Esempio n. 2
0
 private UserDTO(UserEntity entity)
 {
     FirstName = entity.FirstName;
     LastName  = entity.LastName;
     Age       = entity.Age;
     Cash      = (int)entity.Cash;
     Account   = new AccountDTO()
     {
         BankName = entity.Account.BankName,
         Number   = entity.Account.Number
     };
     Debs = entity.Debs.Select(entityDeb => new AccountDTO()
     {
         BankName = entityDeb.BankName,
         Number   = entityDeb.Number
     }).ToList();
     Source       = new UserSourceDTO(providerName: entity.Source.ProviderName, providerAddress: entity.Source.ProviderAddress);
     ImageData    = entity.ImageData;
     LuckyNumbers = entity.LuckyNumbers;
     Total        = entity.GetTotal();
     MainAddress  = new AddressDTO()
     {
         City       = entity.MainAddress.City,
         ZipCode    = entity.MainAddress.ZipCode,
         Street     = entity.MainAddress.Street,
         FlatNo     = entity.MainAddress.FlatNo,
         BuildingNo = entity.MainAddress.BuildingNo
     };
     Addresses = entity.Addresses.Select(entityAddresse => new AddressDTO()
     {
         City       = entityAddresse.City,
         ZipCode    = entityAddresse.ZipCode,
         Street     = entityAddresse.Street,
         FlatNo     = entityAddresse.FlatNo,
         BuildingNo = entityAddresse.BuildingNo
     }).ToList().AsReadOnly();
     UnitId = entity.Unit.Id;
 }