Beispiel #1
0
        // GET: Professors/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var professor = await _context.Professors
                            .Include(t => t.NeededSoftware)
                            .Include(t => t.CheckedOutItems)
                            .FirstOrDefaultAsync(m => m.ProfessorID == id);

            var software = await _context.Software.ToListAsync();

            var items = await _context.InventoryItems.ToListAsync();

            if (professor == null)
            {
                return(NotFound());
            }

            ProfessorSoftwareViewModel psViewModel = new ProfessorSoftwareViewModel
            {
                Professor      = professor,
                Softwares      = software,
                InventoryItems = items
            };

            return(View(psViewModel));
        }
Beispiel #2
0
        // GET: Professors/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var professor = await _context.Professor
                            .Include(s => s.ProfessorSoftware)
                            .ThenInclude(ps => ps.Software)
                            .FirstOrDefaultAsync(m => m.Id == id);

            var software = await _context.Software.ToListAsync();

            if (professor == null)
            {
                return(NotFound());
            }

            ProfessorSoftwareViewModel psViewModel = new ProfessorSoftwareViewModel
            {
                Professor = professor,
                Software  = software
            };

            return(View(psViewModel));
        }