コード例 #1
0
        /// <summary>
        /// Creates or Updates the passed in Settings Model
        /// </summary>
        /// <param name="settings"></param>
        public void CreateOrUpdateSettings(SettingsModel settings)
        {
            Settings mySettings = _repo.Read(x => x.Key == settings.Key && x.UserId == settings.UserId).FirstOrDefault();

            if (mySettings != null)
            {
                mySettings.Value = settings.Value;
            }
            else
            {
                mySettings = settings.ToEFSettings();
            }

            _repo.CreateOrUpdate(mySettings);
            _uow.SaveChanges();
        }