Exemple #1
0
        public void AddItem(string activeText, string fromURL, string toURL)
        {
            var exists = Items.FirstOrDefault(x => x.ToURL == toURL);

            //si no existe el item previamente
            if (exists == null)
            {
                var active = Items.FirstOrDefault(x => x.IsActive);
                if (active != null)
                {
                    active.IsActive = false;
                }

                var item = new BreadcrumbItemViewModel
                {
                    FromURL  = fromURL,
                    ToURL    = toURL,
                    Text     = activeText,
                    IsActive = true
                };

                Items.Add(item);
            }
            else
            {
                exists.IsActive = true;
                Items.RemoveAll(x => x.CreationDateTime > exists.CreationDateTime);
            }
        }
Exemple #2
0
        public BreadcrumbItemViewModel AddItem(string text, string action = "", string controller = "", string area = "", bool isActive = false)
        {
            var item = new BreadcrumbItemViewModel
            {
                Text       = text,
                Action     = action,
                Controller = controller,
                IsActive   = isActive
            };

            Items.Add(item);

            return(item);
        }