namespace Biskilog_Accounting.Client.Models { /// /// Structure of the sidebar navigation menu items /// public class NavItem { /// /// The unique id of the menu item /// public double Id { get; set; } /// /// The title of the menu item to display /// public string Title { get; set; } = string.Empty; /// /// The description of the menu item or description of the content of the page /// public string Description { get; set; } = string.Empty; /// /// The link to open the specified page tied to the menu item /// public string Link { get; set; } = string.Empty; /// /// The icon of the menu item /// public string Icon { get; set; } = string.Empty; /// /// Children or sub menu item /// public List Children { get; set; } = new List(); } /// /// Contains the list of menu Items /// public static class Menu { public static IEnumerable MenuList() { var menuItems = new List{ new NavItem() { Id = 1, Description = "Analytics page", Icon = "bx-home-circle", Link = "", Title = "Dashboard" }, new NavItem() { Id = 2, Description = "Customers", Icon = "bx-users", Link = "customers", Title = "Customers" }, new NavItem() { Id = 3, Description = "Employees", Icon = "bx-users", Link = "employees", Title = "Employees" }, new NavItem() { Id = 4, Description = "Products", Icon = "bx-box", Link = "", Title = "Products", Children = new List { new NavItem { Id = 4.1, Description = "Inventory", Title = "Inventory" }, new NavItem { Id = 4.2, Description = "Inventory", Title = "Bulk Price Changes" }, new NavItem { Id = 4.3, Description = "Inventory", Title = "Products Statistics", Icon = "bx-detail" } } }, }; var uniqueIds = new HashSet(); //Validates list to check if there are no duplicate Ids foreach (var menuItem in menuItems) { if (!uniqueIds.Add(menuItem.Id)) { throw new Exception($"Duplicate Id found: {menuItem.Id}"); } } return menuItems; } } }