Esempio n. 1
0
        public async Task UpdateAsync(
            Guid userId,
            ProductStatus oldStatus,
            ProductStatus newStatus,
            CancellationToken ct)
        {
            var change = oldStatus.UpdateWithLog(userId, x =>
            {
                x.Name           = newStatus.Name;
                x.IsDeleted      = newStatus.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
            });

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

            await _storage.SaveChangesAsync(ct);
        }
        public async Task UpdateAsync(
            Guid userId,
            ProductCategory oldCategory,
            ProductCategory newCategory,
            CancellationToken ct)
        {
            var change = oldCategory.UpdateWithLog(userId, x =>
            {
                x.Name           = newCategory.Name;
                x.IsDeleted      = newCategory.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
            });

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

            await _storage.SaveChangesAsync(ct);
        }
        public async Task UpdateAsync(
            Guid userId,
            ProductAttribute oldAttribute,
            ProductAttribute newAttribute,
            CancellationToken ct)
        {
            var change = oldAttribute.UpdateWithLog(userId, x =>
            {
                x.Type           = newAttribute.Type;
                x.Key            = newAttribute.Key;
                x.IsDeleted      = newAttribute.IsDeleted;
                x.ModifyDateTime = DateTime.UtcNow;
            });

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

            await _storage.SaveChangesAsync(ct);
        }
Esempio n. 4
0
        public async Task UpdateAsync(Guid userId, Product oldProduct, Product newProduct, CancellationToken ct)
        {
            var change = oldProduct.UpdateWithLog(userId, x =>
            {
                x.AccountId       = newProduct.AccountId;
                x.ParentProductId = newProduct.ParentProductId;
                x.Type            = newProduct.Type;
                x.StatusId        = newProduct.StatusId;
                x.Name            = newProduct.Name;
                x.VendorCode      = newProduct.VendorCode;
                x.Price           = newProduct.Price;
                x.Image           = newProduct.Image;
                x.IsHidden        = newProduct.IsHidden;
                x.IsDeleted       = newProduct.IsDeleted;
                x.ModifyDateTime  = DateTime.UtcNow;
                x.AttributeLinks  = newProduct.AttributeLinks.Map(x.Id);
                x.CategoryLinks   = newProduct.CategoryLinks.Map(x.Id);
            });

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

            await _storage.SaveChangesAsync(ct);
        }