public ActionResult Update(string id, string group = "") { ViewBag.DDLMenu = GetMenuList(); ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.GroupID = group; ViewBag.urlValue = url; var obj = _MenuFunctionService.getById(id); if (obj != null) { return(View(obj)); } return(View()); }
/// <summary> /// Thanh điều hướng /// </summary> /// <param name="controller">Tên controller</param> /// <param name="action">Tên action</param> /// <returns></returns> public PartialViewResult Breadcrumb(string controller = "", string action = "") { //Danh sách menu var list = new List <MenuFunction>(); if (CacheLayer.Exists(ConstField.AllListMenuFunctionCache)) { list = CacheLayer.Get <List <MenuFunction> >(ConstField.AllListMenuFunctionCache); } else { list = _MenuFunctionService.GetAllActive().ToList(); CacheLayer.Add(ConstField.AllListMenuFunctionCache, list, ConstField.TimeCache); } //Khai báo biến List <string> MenuName = new List <string>(); var obj = list.FirstOrDefault(n => n.ControllerName.Equals(controller) && n.ActionName.Equals(action)); if (obj != null) { if (!string.IsNullOrEmpty(obj.Breadcrumb)) { string[] id = obj.Breadcrumb.Split(new string[] { '/' + obj.Id }, StringSplitOptions.RemoveEmptyEntries); if (id != null) { string[] ids = id[0].Split(new Char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); if (ids != null) { foreach (var item in ids) { var Name = _MenuFunctionService.getById(item); if (Name != null) { MenuName.Add(Name.MenuName + "," + controller.ToString()); } } } } } } ViewBag.ObjName = (obj != null && !string.IsNullOrWhiteSpace(obj.MenuName)) ? obj.MenuName : ""; ViewBag.listMenu = MenuName; return(PartialView()); }