Ejemplo n.º 1
0
        // GET: Devices
        public IActionResult Index()
        {
            /*return View(await _context.Devices
             *  .Include(d => d.Manufacturer)
             *  .Include(d => d.Product)
             *  .ToListAsync());
             */
            var deviceList = _context.Devices //_deviceService.GetAll()
                             .Select(device => new DeviceListingModel
            {
                Id = device.Id,
                ManufacturerName = device.Product.Manufacturer.ManufacturerName,
                ProductName      = device.Product.ProductName,
                MacAddress       = device.MacAddress,
                Firmware         = device.Firmware,
                Quantity         = device.Quantity
            });

            var model = new DeviceIndexModel
            {
                DeviceList = deviceList
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public IActionResult Device()
        {
            var deviceList = _context.Devices //_deviceService.GetAll()
                             .Select(device => new DeviceListingModel
            {
                Id = device.Id,
                ManufacturerName = device.Product.Manufacturer.ManufacturerName,
                ProductName      = device.Product.ProductName,
                MacAddress       = device.MacAddress,
                Firmware         = device.Firmware,
                Quantity         = device.Quantity
            });

            var model = new DeviceIndexModel
            {
                DeviceList = deviceList
            };

            return(View(model));
        }
        public IActionResult Index()
        {
            var deviceModels = _devices.GetAll();

            var listingResult = deviceModels.Select(result => new DeviceIndexListingModel
            {
                Id           = result.Id,
                Description  = result.Description,
                ImageUrl     = result.ImageUrl,
                OS           = result.OS,
                Site         = result.Site.Name,
                Status       = result.Status.Description,
                CheckedOutTo = _checkouts.GetCurrentCheckoutUser(result.Id)
            });

            var model = new DeviceIndexModel()
            {
                Devices = listingResult
            };

            return(View(model));
        }