public CompanyEntity ConvertToEntity(CompanyModel entity) { if (entity == null) return null; var model = new CompanyEntity(entity.Id) { EncryptionKey = entity.EncryptionKey, Name = entity.Name }; return model; }
public async Task<CompanyModel> ConvertToModel(CompanyEntity entity) { if (entity == null) return null; var model = new CompanyModel(entity.Id) { EncryptionKey = entity.EncryptionKey, Name = entity.Name }; model.Addresses = await AddressRepository.Instance.GetAddresses(entity.AddressIds); model.Customers = await CustomerRepository.Instance.GetCutomersByCompanyId(entity.Id); return model; }