Exemple #1
0
        public async Task UpdateAsync(
            Guid userId,
            StockRoom oldRoom,
            StockRoom newRoom,
            CancellationToken ct)
        {
            var change = oldRoom.UpdateWithLog(userId, x =>
            {
                x.Name           = newRoom.Name;
                x.IsDeleted      = newRoom.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
            });

            _storage.Update(oldRoom);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }
        public async Task UpdateAsync(
            Guid userId,
            StockConsumption oldConsumption,
            StockConsumption newConsumption,
            CancellationToken ct)
        {
            var change = oldConsumption.UpdateWithLog(userId, x =>
            {
                x.AccountId      = newConsumption.AccountId;
                x.Type           = newConsumption.Type;
                x.OrderId        = newConsumption.OrderId;
                x.IsDeleted      = newConsumption.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
                x.Items          = newConsumption.Items.Map(x.Id);
            });

            _storage.Update(oldConsumption);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }
        public async Task UpdateAsync(
            Guid userId,
            StockArrival oldArrival,
            StockArrival newArrival,
            CancellationToken ct)
        {
            var change = oldArrival.UpdateWithLog(userId, x =>
            {
                x.AccountId      = newArrival.AccountId;
                x.Type           = newArrival.Type;
                x.SupplierId     = newArrival.SupplierId;
                x.OrderId        = newArrival.OrderId;
                x.InventoryId    = newArrival.InventoryId;
                x.IsDeleted      = newArrival.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
                x.Items          = newArrival.Items.Map(x.Id);
            });

            _storage.Update(oldArrival);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }
        public async Task UpdateAsync(
            Guid userId,
            StockBalance oldBalance,
            StockBalance newBalance,
            CancellationToken ct)
        {
            var change = oldBalance.UpdateWithLog(userId, x =>
            {
                x.AccountId      = newBalance.AccountId;
                x.RoomId         = newBalance.RoomId;
                x.ProductId      = newBalance.ProductId;
                x.Count          = newBalance.Count;
                x.IsDeleted      = newBalance.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;

                // x.UniqueElementIds = newBalance.UniqueElementIds;
            });

            _storage.Update(oldBalance);
            await _storage.AddAsync(change, ct);

            await _storage.SaveChangesAsync(ct);
        }