示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <inheritdoc />
 public void SaveChanges(ItemDisplayPreferences preferences)
 {
     using var dbContext = _dbProvider.CreateContext();
     dbContext.Update(preferences);
     dbContext.SaveChanges();
 }