Beispiel #1
0
        public async Task <int> SaveUserPreference(PreferenceType preferenceType, string username, string bundle)
        {
            var context = Context as DwhDashboardContext;

            var preferences = context.UserPreferences.Where(x => x.UserName.ToLower() == username.ToLower()).ToList();

            context.UserPreferences.RemoveRange(preferences);
            await context.SaveChangesAsync();

            var userPreference = UserPreference.Create(username, preferenceType, bundle);

            context.UserPreferences.Attach(userPreference);
            return(await context.SaveChangesAsync());
        }