zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

Issue with Manual nodes #45

Closed snehal20gawade closed 5 years ago

snehal20gawade commented 5 years ago

Trying to create manual nodes like below but somehow both nodes are pointing to Post1 action: /Java/Advanced/Post1

Advance node should point to /Java/Advanced/Index but it's not. Am I doing something wrong ?


namespace RazorPagesAndMvc.Controllers.Java
{
    [Route("Java/Advanced/[action]")]
    public class AdvancedJavaController : Controller
    {
        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }

        [HttpPost]
        [Breadcrumb("Advanced", FromAction = "Index", FromController = typeof(JavaController))]
        public IActionResult Index(int i)
        {
            return View();
        }

        [HttpGet]
        public IActionResult Post1()
        {
            var childNode1 = new MvcBreadcrumbNode("Index", "Advanced", "Advance")
            {
                OverwriteTitleOnExactMatch = false,
            };

            var childNode2 = new MvcBreadcrumbNode("Post1", "Advanced", "Post1")
            {
                OverwriteTitleOnExactMatch = false,
                Parent = childNode1
            };

            ViewData["BreadcrumbNode"] = childNode2;
            return View();
        }

    }
}