using PartSource.Data.Contexts; using PartSource.Data.Models; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Ratermania.Shopify.Resources; namespace PartSource.Services { public class ShopifyChangelogService { private readonly PartSourceContext _partsourceContext; public ShopifyChangelogService(PartSourceContext partsourceContext) { _partsourceContext = partsourceContext; } public async Task AddEntry(T data) where T : BaseShopifyResource { ShopifyChangelog shopifyChangelog = new ShopifyChangelog { ResourceType = typeof(T), ShopifyId = data.Id, Data = data, Timestamp = DateTime.Now }; await _partsourceContext.AddAsync(shopifyChangelog); await _partsourceContext.SaveChangesAsync(); } } }