Exemple #1
0
        public IActionResult Adjust(AdjustView model)
        {
            if (model.Inventory.Amount == 0)
            {
                ModelState.AddModelError("Inventory.Amount", "You must supply a non-zero inventory adjustment (count/amount).");
            }

            if (ModelState.IsValid)
            {
                model.Inventory.DepartmentId  = DepartmentId;
                model.Inventory.TimeStamp     = DateTime.UtcNow;
                model.Inventory.AddedByUserId = UserId;

                if (model.UnitId > 0)
                {
                    model.Inventory.UnitId = model.UnitId;
                }

                _inventoryService.SaveInventory(model.Inventory);

                return(RedirectToAction("Index"));
            }

            model.Types    = _inventoryService.GetAllTypesForDepartment(DepartmentId);
            model.Stations = _departmentGroupsService.GetAllStationGroupsForDepartment(DepartmentId);

            return(View(model));
        }
Exemple #2
0
        public IActionResult Adjust()
        {
            var model = new AdjustView();

            model.Inventory = new Inventory();
            model.Types     = _inventoryService.GetAllTypesForDepartment(DepartmentId);
            model.Stations  = _departmentGroupsService.GetAllStationGroupsForDepartment(DepartmentId);

            return(View(model));
        }
        public async Task <IActionResult> Adjust()
        {
            var model = new AdjustView();

            model.Inventory = new Inventory();
            model.Types     = await _inventoryService.GetAllTypesForDepartmentAsync(DepartmentId);

            model.Stations = await _departmentGroupsService.GetAllStationGroupsForDepartmentAsync(DepartmentId);

            return(View(model));
        }