コード例 #1
0
        public IActionResult OnGetDecrease(long id)
        {
            var decrease = new DecreaseInventory
            {
                InventoryId = id
            };

            return(Partial("Decrease", decrease));
        }
コード例 #2
0
        public IActionResult OnGetDecrement(long id)
        {
            var decreaseInventory = new DecreaseInventory()
            {
                InventoryId = id
            };

            return(Partial("Decrement", decreaseInventory));
        }
コード例 #3
0
        public IActionResult OnPostDecrement(DecreaseInventory command)
        {
            var operationResult = new OperationResult();

            if (ModelState.IsValid)
            {
                operationResult = _inventoryApplication.Decrease(command);
            }
            return(new JsonResult(operationResult));
        }
コード例 #4
0
        public OperationResult Decrease(DecreaseInventory command)
        {
            var operationResult = new OperationResult();
            var inventory       = _inventoryRepository.Get(command.InventoryId);

            if (inventory == null)
            {
                return(operationResult.Failed(QueryValidationMessage.NotFound));
            }
            inventory.Decrease(command.Count, 1, command.Description, 0);
            _inventoryRepository.SaveChanges();
            return(operationResult.Succeeded());
        }
コード例 #5
0
        public OperationResult Decrease(DecreaseInventory command)
        {
            var operation = new OperationResult();
            var inventory = _inventoryRepository.Get(command.InventoryId);

            if (inventory == null)
            {
                return(operation.Failed(ApplicationMessages.RecordNotFound));
            }

            var operatorId = _authHelper.CurrentAccountId();

            inventory.Decrease(command.Count, operatorId, command.Description, 0);

            _inventoryRepository.SaveChanges();

            return(operation.Succedded());
        }
コード例 #6
0
        public JsonResult OnPostDecrease(DecreaseInventory command)
        {
            var result = _inventoryApplication.Decrease(command);

            return(new JsonResult(result));
        }