Beispiel #1
0
        public async Task <GoodsDTO> CreateAsync(
            [NotNull] GoodsDTO entity,
            CancellationToken token = default(CancellationToken))
        {
            Guard.NotNull(entity, nameof(entity));

            _context.Goods.Add(entity);

            await _context.SaveChangesAsync(token).ConfigureAwait(false);

            return(entity);
        }
        public async Task CancelOrderByIdAsync(
            int entityId,
            CancellationToken token = default(CancellationToken))
        {
            if (!await ExistsByIdAsync(entityId, token))
            {
                return;
            }

            _context.Orders.Update(new OrderDTO
            {
                Id     = entityId,
                Status = OrderStatus.Cancelled
            });

            await _context.SaveChangesAsync(token);
        }