public ActionResult AdminIndex(string user_ID) { IsSuperAdmin = false; userID = user_ID; List <UsersManhals> manhalsID = contextuser.GetAllBy(a => a.UserId == user_ID); List <Manahel> manahels = new List <Manahel>(); foreach (var item in manhalsID) { manahels.Add(context1.GetElement(item.ManelId)); } //ViewData["IsSuperAdmin"] = IsSuperAdmin; //ViewData["Manahel"] = manahels;//context1.GetAllManahelsMenuTest(); return(View(manahels)); }
public IViewComponentResult Invoke() { List <Manahel> manahels = new List <Manahel>(); if (ManahelsController.IsSuperAdmin) { List <UsersManhals> manhalsID = contextuser.GetAll(); foreach (var item in manhalsID) { manahels.Add(context1.GetElement(item.ManelId)); } } else { List <UsersManhals> manhalsID = contextuser.GetAllBy(a => a.UserId == ManahelsController.userID); foreach (var item in manhalsID) { manahels.Add(context1.GetElement(item.ManelId)); } } return(View("GetManahal2", manahels)); }