public void Reset() { var existingState = Entities.ShopifyBatchStates.FirstOrDefault(); if (existingState != null) { Entities.ShopifyBatchStates.Remove(existingState); } var newState = new ShopifyBatchState(); Entities.ShopifyBatchStates.Add(newState); Entities.SaveChanges(); }
public ShopifyBatchState Retrieve() { lock (_lock) { var output = _dataContext .Entities .ShopifyBatchStates.FirstOrDefault(); if (output == null) { var newState = new ShopifyBatchState(); Entities.ShopifyBatchStates.Add(newState); return(newState); } else { return(output); } } }