Esempio n. 1
0
        public async Task <bool> changeQuantity(ChangeQuantityModel model)
        {
            var query = _cartRepository.GetById(model.CartId);

            query.Quantity = model.quantity;
            _cartRepository.Update(query);
            await _unitOfWork.CommitAsync();

            return(true);
        }
        public IHttpActionResult ChangeQuantity([FromBody] ChangeQuantityModel model)
        {
            var id            = AggregateId.NewAggregateId(model.Id);
            var versionNumber = AggregateVersion.Irrelevant;
            var cmd           = model.Difference >= 0
                ? Command.NewAddToStock(model.Difference)
                : Command.NewRemoveFromStock(model.Difference);

            var envelope = createCommand(id, versionNumber, null, null, null, cmd);

            QueueCommand(envelope);

            return(Ok());
        }
Esempio n. 3
0
        public async Task ChangeQuantity([FromBody] ChangeQuantityModel model)
        {
            await _cartService.changeQuantity(model);

            Response.StatusCode = (int)HttpStatusCode.OK;
        }