Use lazy loading of related tables.

This commit is contained in:
2018-08-06 23:33:39 +01:00
parent d540e281cf
commit 7565a8966a
29 changed files with 3077 additions and 681 deletions

View File

@@ -65,8 +65,7 @@ namespace cicm_web.Controllers
public IActionResult View(int id)
{
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
Company company = _context.Companies.Where(c => c.Id == id).Include(c => c.Description)
.Include(c => c.Machines).Include(c => c.Country).FirstOrDefault();
Company company = _context.Companies.FirstOrDefault(c => c.Id == id);
if(company == null) return Index();