/// <summary> /// Gets the overview for a combobox /// </summary> public static List <CategoryItem> GetOverview(int?parentId = null, string prefix = "", int excludeId = 0, bool addSelect = true) { var result = new List <CategoryItem>(); if (addSelect) { result.Add(new CategoryItem() { ID = null, Name = "- Select -" }); } List <Categories> _overview = DAL_Categories.GetAll(parentId, excludeId); foreach (var _item in _overview) { result.Add(new CategoryItem() { ID = _item.Id, Name = ($"{prefix} {_item.Name}").Trim() }); string prefixNext = prefix + "-"; result.AddRange(GetOverview(_item.Id, prefixNext, excludeId, false)); } return(result); }
/// <summary> /// Get all the product categories in a list /// </summary> /// <returns>List of product categories</returns> public static List <Categories> GetAll() { try { return(DAL_Categories.GetAll()); } catch (Exception) { throw; } }
/// <summary> /// update the model /// </summary> private static void Update(Categories model) { try { DAL_Categories.Update(model); } catch (Exception) { throw; } }