/// <inheritdoc /> public ItemDisplayPreferences GetItemDisplayPreferences(Guid userId, Guid itemId, string client) { var prefs = _dbContext.ItemDisplayPreferences .FirstOrDefault(pref => pref.UserId.Equals(userId) && pref.ItemId.Equals(itemId) && string.Equals(pref.Client, client)); if (prefs == null) { prefs = new ItemDisplayPreferences(userId, Guid.Empty, client); _dbContext.ItemDisplayPreferences.Add(prefs); } return(prefs); }
/// <inheritdoc /> public ItemDisplayPreferences GetItemDisplayPreferences(Guid userId, Guid itemId, string client) { using var dbContext = _dbProvider.CreateContext(); var prefs = dbContext.ItemDisplayPreferences .FirstOrDefault(pref => pref.UserId == userId && pref.ItemId == itemId && string.Equals(pref.Client, client)); if (prefs == null) { prefs = new ItemDisplayPreferences(userId, Guid.Empty, client); dbContext.ItemDisplayPreferences.Add(prefs); } return(prefs); }
/// <inheritdoc /> public void SaveChanges(ItemDisplayPreferences preferences) { using var dbContext = _dbProvider.CreateContext(); dbContext.Update(preferences); dbContext.SaveChanges(); }