Stuff and things

This commit is contained in:
2021-06-29 19:00:13 -04:00
parent 0ff42f148a
commit 962ad3383f
22 changed files with 320 additions and 226 deletions

View File

@@ -0,0 +1,34 @@
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>(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();
}
}
}