private CompaniesListViewModel ToCompaniesListViewModel(Company[] companies) { var companiesViewModel = new CompaniesListViewModel(); companiesViewModel.List = companies.Select ( x => ToCompanyViewModel(x) ) .ToArray(); return companiesViewModel; }
private CompanyViewModel ToCompanyViewModel(Company company) { return new CompanyViewModel { Id = company.Id, Name = company.Name, AboutUs = company.AboutUs, City = company.City, Country = company.Country, EmployeeSize = company.EmployeeSize, PrincipalProducts = company.PrincipalProducts?.Select(ToPrincipalProductViewModel).ToArray() }; }