public Setting Save(Setting item) { Setting repItem = this._list.Where(x => x.Id == item.Id).SingleOrDefault(); if (repItem != null) { this._list.Remove(repItem); } else { int maxId = this._list.Max(x => x.Id); item.Id = maxId + 1; } this._list.Add(item); return item; }
/// <summary> /// Deletes an item from the database. /// </summary> /// <param name="item">Item to delete.</param> public bool Delete(Setting item) { bool deleteSuccess = false; try { Db4O.Container.Delete(item); deleteSuccess = true; } catch (Exception ex) { Console.WriteLine(ex.Message); } return deleteSuccess; }
private Setting FillSettingFromRepository() { var setting = _repository.Get().FirstOrDefault(); // If there isn't a setting object in the repository, hardcode a setting instance if (Equals(setting, null)) { var newSettings = new Setting { AllowExpiredContentReActivation = true, AllowRejectedContentReActivation = false, ContentExtractLength = 15, GridPageSize = 10, SettingsCacheTimeInMinutes = 5, ShowContentEllipsis = true, ModifiedBy = "XXXX" }; setting = this.Save(newSettings); } return setting; }
/// <summary> /// Saves an item to the database. /// </summary> /// <param name="item">Item to save.</param> public Setting Save(Setting item) { Db4O.Container.Store(item); return item; }
public bool Delete(Setting entity) { throw new System.NotImplementedException(); }
public Setting Save(Setting settings) { _cacheService.Remove(Resources.EN.Strings.System_ContentManagerSettingsCacheKey); return _repository.Save(settings); }