public virtual List <MenuModel> GetMyAppsMenu() { var myAppsMenu = new List <MenuModel>(); try { myAppsMenu = AppMenu.GetMyAppsMenu(AppCode, HeaderModel.LabelMenuMyApps); } catch (Exception ex) { } return(myAppsMenu); }
public virtual JsonResult GetMyAppsMenu() { var myAppsMenu = new List <dynamic>(); var cacheKey = string.Empty; try { var menuList = default(List <MenuModel>); if (UserClaims != null) { //Creates a cacheKey using user login cacheKey = "myAppsMenu" + UserClaims.FirstOrDefault(uc => uc.ClaimType == ClaimTypes.WindowsAccountName).Value; menuList = (List <MenuModel>)HttpContext.Cache.Get(cacheKey); } if (menuList == null || menuList.Count <= 0) { menuList = AppMenu.GetMyAppsMenu(AppCode, Header.LabelMenuMyApps); if (!string.IsNullOrEmpty(cacheKey)) { HttpContext.Cache.Add(cacheKey, menuList, null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); } } //Changes menu label for current Culture menuList.FirstOrDefault().Text = Header.LabelMenuMyApps; myAppsMenu = AppMenu.CastToDynamicMenuList(menuList); } catch (Exception ex) { } return(Json(myAppsMenu, JsonRequestBehavior.AllowGet)); }