public async Task <IActionResult> Register()
        {
            AddItemViewModel model = new AddItemViewModel
            {
                ItemTypes = _combosHelper.GetComboItemType(),
                Brands    = _combosHelper.GetComboBrands()
            };

            return(View(model));
        }
 public DeviceViewModel ToDeviceViewModel(Movement movement)
 {
     return(new DeviceViewModel
     {
         DeviceId = movement.Device.Id,
         WareHouseManagerId = movement.Device.Inventory.WarehouseManager.Id,
         BrandId = movement.Device.Brand.Id,
         InventoryId = movement.Device.Inventory.Id,
         WareHouseId = movement.Device.Warehouse.Id,
         MovementTypeId = movement.MovementType.Id,
         DateInventary = movement.Device.Inventory.DateInventary,
         ListDevices = _combosHelper.GetComboDevices(),
         ListBrands = _combosHelper.GetComboBrands(),
         ListMovements = _combosHelper.GetComboMovementTypes(),
         CodeIntegral = movement.Device.CodeIntegral,
         CodeValorar = movement.Device.CodeValorar,
         SerialNumber = movement.Device.SerialNumber,
         Description = movement.Device.Description,
         IsActive = movement.Device.IsActive
     });
 }
예제 #3
0
        public async Task <IActionResult> AddDeviceToInventory(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var inventory = await _dataContext.Inventories
                            .Include(i => i.Warehouse)
                            .Include(wm => wm.WarehouseManager)
                            .ThenInclude(u => u.User)
                            .Include(i => i.Devices)
                            .ThenInclude(b => b.Brand)
                            .ThenInclude(d => d.Devices)
                            .ThenInclude(dt => dt.DeviceType)
                            .ThenInclude(d => d.Devices)
                            .ThenInclude(m => m.Movements)
                            .ThenInclude(mt => mt.MovementType)
                            .FirstOrDefaultAsync(m => m.Id == id);

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

            var model = new DeviceViewModel
            {
                WareHouseId        = inventory.Warehouse.Id,
                WareHouseManagerId = inventory.WarehouseManager.Id,
                DateInventary      = DateTime.Today,
                ListDevices        = _combosHelper.GetComboDevices(),
                ListBrands         = _combosHelper.GetComboBrands(),
                ListMovements      = _combosHelper.GetComboMovementTypes(),
                InventoryId        = inventory.Id
            };

            return(View(model));
        }