// GET: Companies/Details/5 public IActionResult Details(int?id) { var companyId = (int)id; var company = _companyRepository.Get(companyId); if (company != null) { var employees = _companyEmployeeRepository.GetQueryable() .Include(item => item.Employee) .Where(cm => cm.CompanyId == id) .ToList(); var locations = _companyLocationRepository.GetQueryable() .Include(item => item.Location) .Where(cm => cm.CompanyId == id) .ToList(); var viewCompanyViewModel = new ViewCompanyViewModel { Company = company, CompanyEmployees = employees, CompanyLocations = locations }; return(View(viewCompanyViewModel)); } return(NotFound()); }
public ViewCompany() { InitializeComponent(); _VCVM = new ViewCompanyViewModel(); this.DataContext = _VCVM; }