Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 /// <inheritdoc />
 public void SaveChanges(ItemDisplayPreferences preferences)
 {
     using var dbContext = _dbProvider.CreateContext();
     dbContext.Update(preferences);
     dbContext.SaveChanges();
 }