Stuff and things
This commit is contained in:
34
PartSource.Services/ShopifyChangelogService.cs
Normal file
34
PartSource.Services/ShopifyChangelogService.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user