/// <summary> /// Gets a list of the Templates in the Collection /// </summary> /// <param name="templateType">Optionally filter only templates of a type</param> /// <returns>List of the Templates</returns> public List <Template> List(Type templateType = null) { return(DatabaseItems.Select(dbitem => dbitem.Value) .OrderBy(template => template.ID) .Where(template => templateType == null || template.GetType() == templateType || template.GetType().IsSubclassOf(templateType)) .ToList()); }
/// <summary> /// Gets a Template by TemplateName /// </summary> /// <param name="name">The TemplateName</param> /// <returns>The Template or null if not found</returns> public Template Get(string name) { return(DatabaseItems .Select(item => item.Value) .FirstOrDefault(item => item.Name.Equals(name))); }
/// <summary> /// Gets a Template by ID /// </summary> /// <param name="id"></param> /// <returns>The Template or null if not found</returns> public Template Get(int id) { return(DatabaseItems .Select(item => item.Value) .FirstOrDefault(item => item.ID == id)); }