public Word GetWordByNameCategoryAndWordPackID(string Name, int CategoryID, int WordPackID) { Filter[] Filters = new Filter[] { new Filter(FilterType.And, new Field[] { NameField, CategoryIDField, WordPackIDField }, new string[] { "Name", "CategoryID", "WordPackID" }, new object[] { Name, CategoryID, WordPackID }) }; var Words = GetObjectsByFilters(Filters); Word word = Words.Cast<Word>().ToList().FirstOrDefault(); if (word == null) { word = new Word(0, Name, CategoryID, WordPackID); } return word; }
public bool SaveWord(Word word) { SettingsHandler.instance.CurrentSettings.WordLastUpdated = TimeConverter.GetDateTime(); SettingsHandler.instance.SaveSettings(); try { if (word.ID == 0) { AddObject(word); } else { UpdateObject(word); } return true; } catch (Exception e) { new WebsiteException(e, ErrorOrigin.Website, this.ToString()); return false; } }
public void DeleteWord(Word word) { DeleteObject(word); }