private void PrepareLeagueModel(NavbarModel model, UserContext userContext) { if (userContext.User.UserSettings == null || userContext.User.UserSettings.Count == 0) { try { var ligas = userContext.User.Ligas; if (ligas != null && ligas.Count > 0) { _workContext.SaveUserSetting(SettingBase.League, ligas.FirstOrDefault().Id.ToString()); } } catch (Exception ex) { //REV } } foreach (var liga in userContext.User.Ligas) { model.Leagues.Leagues.Add(new League() { Name = liga.Name, IdLeague = liga.Id, Selected = (userContext.IdLeague == liga.Id) }); } }
public NavbarTemplate(NavbarModel model, IApplication application, ControlWriter controlWriter) { Model = model; Application = application; ControlWriter = controlWriter; application.EventDispatcher.Publish(new AngularImportDependencyRequiredEvent( moduleId: "AppModule", dependency: "CollapseModule.forRoot()", import: "import { CollapseModule } from 'ngx-bootstrap/collapse';")); }
public ActionResult NavBar() { var userContext = _workContext.GetAuthenticatedUser(); NavbarModel model = new NavbarModel(); PrepareLeagueModel(model, userContext); PrepareUserDataModel(model, userContext.User); return(View(model)); }
public PartialViewResult _Navbar() { int cartItemCount = Task.Run(async() => { return((await cartService.GetCartAsync(User.Identity.GetUserId())).Count); }).Result; NavbarModel model = new NavbarModel { Categories = context.Categories.ToList(), CartItemCount = cartItemCount }; return(PartialView("_Navbar", model)); }
public PartialViewResult _Navbar() { List <Category> categories = Task.Run(async() => { categories = await categoryService.GetAllAsync(); return(categories); }).Result; NavbarModel model = new NavbarModel { Categories = categories }; return(PartialView("_Navbar", model)); }
public PartialViewResult _Navbar() { int cartItemCount = Task.Run(async() => { return((await cartService.GetCartAsync(User.Identity.GetUserId())).Count); }).Result; List <Category> categories = Task.Run(async() => { categories = await categoryService.GetAllAsync(); return(categories); }).Result; NavbarModel model = new NavbarModel { Categories = categories, CartItemCount = cartItemCount }; return(PartialView("_Navbar", model)); }
public async Task<IViewComponentResult> InvokeAsync(IndexPair indexPair) { NavbarModel model = null; if (User.Identity.IsAuthenticated) { model = NavbarModel.DefaultItems((int)indexPair.IndexWhenUserAuthorized); } else { model = NavbarModel.NonAuthorizableItems((int)indexPair.IndexWhenUserAnonymus); } //debug //model = NavbarModel.DefaultItems((int)activeIndex); // return View(model); }
private void PrepareUserDataModel(NavbarModel model, User user) { var roles = Roles.GetRolesForUser(user.UserName); model.User.Name = user.Persona.GetFullName(); string r = _media.GetUserAvatarUrl(user.UserName); if (!String.IsNullOrEmpty(r)) { model.User.AvatarUrl = Url.Content(r); } else { model.User.AvatarUrl = r; } if (roles.Contains(WorkContext.AppRoles.Admin)) { model.User.AccessToAdmin = true; } }
public IViewComponentResult Invoke() { var currentController = ViewContext.RouteData.Values["controller"].ToString(); var menus = new List <MenuItem>(); menus.Add(new MenuItem { Text = "Home", Url = Url.Action("Index", "App"), Active = currentController == "Home" }); var model = new NavbarModel { DisplayNavigation = User.Identity.IsAuthenticated, Username = User.Identity.Name, MenuItems = menus }; return(View(model)); }
public List <NavbarModel> NavbarOlustur(int?KullaniciId) { var Rotalar = kullaniciYonetimi.TumRotalariGetir().OrderBy(p => p.Sira).ToList(); List <NavbarModel> navbarListModel = new List <NavbarModel>(); for (int i = 0; i < Rotalar.Count; i++) { if (Rotalar[i].HerkesGirebilirMi == true && Rotalar[i].GosterilecekMi == true) { var eklenecek = new NavbarModel(); if (Rotalar[i].RotaTablo_RotaId == null) { eklenecek.AltKategoriMi = false; eklenecek.UrlText = Rotalar[i].LinkAdi; eklenecek.UrlYol = Rotalar[i].ControllerAdi + "/" + Rotalar[i].ActionAdi; eklenecek.UrlClass = Rotalar[i].LinkClass; var altKategoriler = kullaniciYonetimi.AltRotalariGetir(Rotalar[i].RotaId); if (altKategoriler.Count > 0) { eklenecek.AltKategoriSayisi = altKategoriler.Count; eklenecek.DropDownBaslik = Rotalar[i].DropdownBaslikAdi; eklenecek.AltKategoriler = new List <NavbarModel>(); for (int j = 0; j < altKategoriler.Count; j++) { var eklenecekAltKategori = new NavbarModel(); eklenecekAltKategori.AltKategoriMi = true; eklenecekAltKategori.UrlText = altKategoriler[j].LinkAdi; eklenecekAltKategori.UrlYol = altKategoriler[j].ControllerAdi + "/" + altKategoriler[j].ActionAdi; eklenecek.AltKategoriler.Add(eklenecekAltKategori); } navbarListModel.Add(eklenecek); } else { navbarListModel.Add(eklenecek); } } } else { if (kullaniciYonetimi.GirebilirMi(Rotalar[i].RotaId, KullaniciId)) { if (Rotalar[i].GosterilecekMi == true) { var eklenecek = new NavbarModel(); if (Rotalar[i].RotaTablo_RotaId == null) { eklenecek.AltKategoriMi = false; eklenecek.UrlText = Rotalar[i].LinkAdi; eklenecek.UrlYol = Rotalar[i].ControllerAdi + "/" + Rotalar[i].ActionAdi; eklenecek.UrlClass = Rotalar[i].LinkClass; var altKategoriler = kullaniciYonetimi.AltRotalariGetir(Rotalar[i].RotaId); if (altKategoriler.Count > 0) { eklenecek.AltKategoriSayisi = altKategoriler.Count; eklenecek.DropDownBaslik = Rotalar[i].DropdownBaslikAdi; eklenecek.AltKategoriler = new List <NavbarModel>(); for (int j = 0; j < altKategoriler.Count; j++) { var eklenecekAltKategori = new NavbarModel(); eklenecekAltKategori.AltKategoriMi = true; eklenecekAltKategori.UrlText = altKategoriler[j].LinkAdi; eklenecekAltKategori.UrlYol = altKategoriler[j].ControllerAdi + "/" + altKategoriler[j].ActionAdi; eklenecek.AltKategoriler.Add(eklenecekAltKategori); } navbarListModel.Add(eklenecek); } else { navbarListModel.Add(eklenecek); } } } } } } return(navbarListModel); //List<YetkiTablo> Yetkiler = kullaniciYonetimi.TumYetkileriGetir(); //Yetkiler = Yetkiler.Where(p => p.KullaniciBilgileriTablo_KullaniciId == KullaniciId // && p.GirebilirMi == true).OrderBy(p=>p.RotaTablo.Sira).ToList(); //List<NavbarModel> navbarListModel = new List<NavbarModel>(); //for (int i = 0; i < Yetkiler.Count; i++) //{ // NavbarModel navbar = new NavbarModel(); // if (Yetkiler[i].RotaTablo.RotaTablo_RotaId == null) // { // if (Yetkiler[i].GirebilirMi == true && Yetkiler[i].RotaTablo.GosterilecekMi == true) // { // var altKategoriler = Yetkiler // .Where(p => p.RotaTablo.RotaTablo_RotaId == Yetkiler[i].RotaTablo.RotaId).ToList(); // if (altKategoriler.Count == 0) // { // navbar.AltKategoriMi = false; // navbar.UrlText = Yetkiler[i].RotaTablo.LinkAdi; // navbar.UrlYol = Yetkiler[i].RotaTablo.ControllerAdi + "/" + Yetkiler[i].RotaTablo.ActionAdi; // navbarListModel.Add(navbar); // } // else // { // navbar.AltKategoriMi = false; // navbar.AltKategoriSayisi = altKategoriler.Count; // navbar.UrlText = Yetkiler[i].RotaTablo.LinkAdi; // navbar.DropDownBaslik = Yetkiler[i].RotaTablo.DropdownBaslikAdi; // navbar.UrlYol = Yetkiler[i].RotaTablo.ControllerAdi + "/" + Yetkiler[i].RotaTablo.ActionAdi; // navbar.altKategoriler = new List<NavbarModel>(); // for (int j = 0; j < altKategoriler.Count; j++) // { // if (altKategoriler[j].GirebilirMi == true && altKategoriler[j].RotaTablo.GosterilecekMi == true) // { // NavbarModel altKategoriNavbar = new NavbarModel(); // altKategoriNavbar.AltKategoriMi = true; // altKategoriNavbar.UrlText = altKategoriler[j].RotaTablo.LinkAdi; // altKategoriNavbar.UrlYol = altKategoriler[j].RotaTablo.ControllerAdi + "/" + altKategoriler[j].RotaTablo.ActionAdi; // navbar.altKategoriler.Add(altKategoriNavbar); // } // } // navbarListModel.Add(navbar); // } // //navbar.AltKategoriMi = false; // //navbar.UrlText = Yetkiler[i].RotaTablo.LinkAdi; // //navbar.UrlYol = Yetkiler[i].RotaTablo.ControllerAdi + "/" + Yetkiler[i].RotaTablo.ActionAdi; // //navbar.AltKategoriSayisi = altKategoriler.Count; // //navbarListModel.Add(navbar); // //for (int j = 0; j < altKategoriler.Count; j++) // //{ // // if (altKategoriler[j].GirebilirMi==true && altKategoriler[j].RotaTablo.GosterilecekMi==true) // // { // // NavbarModel altKategoriNavbar = new NavbarModel(); // // altKategoriNavbar.AltKategoriMi = true; // // altKategoriNavbar.UrlText = altKategoriler[j].RotaTablo.LinkAdi; // // altKategoriNavbar.UrlYol = altKategoriler[j].RotaTablo.ControllerAdi + "/" + altKategoriler[j].RotaTablo.ActionAdi; // // navbarListModel.Add(altKategoriNavbar); // // } // //} // } // } //} //return navbarListModel; }
public NavbarModel LoadSidebar() { if (MainMenus != null) { return(MainMenus); } MainMenus = new NavbarModel(); var menuList = new List <NavbarItemModel>(); menuList.Add(new NavbarItemModel { Caption = "控制面板", Link = "/", style = "icon-speedometer" }); //menuList.Add(new NavbarItemModel { ItemType = NavbarItemType.TextOnly, Caption = "Theme" }); menuList.Add(new NavbarItemModel { Caption = "计数器", Link = "/Counter", style = "icon-drop" }); //menuList.Add(new NavbarItemModel { Caption = "Typography", Link = "colors.html", style = "icon-pencil" }); //menuList.Add(new NavbarItemModel { ItemType = NavbarItemType.TextOnly, Caption = "Components" }); //menuList.Add(new NavbarItemModel //{ // ItemType = NavbarItemType.DropDown, // Caption = "Base", // style = "icon-puzzle", // Children = new List<NavbarItemModel>() // { // new NavbarItemModel { Caption = "Breadcrumb", Link = "base/breakcrumb.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Breadcrumb", Link = "base/breakcrumb.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Cards", Link = "base/cards.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Carousel", Link = "base/carousel.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Collapse", Link = "base/collapse.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Forms", Link = "base/forms.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Jumbotron", Link = "base/jumbotron.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "List group", Link = "base/list-group.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Navs", Link = "base/navs.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Pagination", Link = "base/pagination.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Popovers", Link = "base/popovers.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Progress", Link = "base/progress.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Scrollspy", Link = "base/scrollspy.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Switches", Link = "base/switches.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Tables", Link = "base/tables.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Tabs", Link = "base/tabs.html", style = "icon-puzzle" }, // new NavbarItemModel { Caption = "Tooltips", Link = "base/tooltips.html", style = "icon-puzzle" } // } //}); //menuList.Add(new NavbarItemModel //{ // ItemType = NavbarItemType.DropDown, // Caption = "Buttons", // style = "icon-cursor", // Children = new List<NavbarItemModel>() // { // new NavbarItemModel { Caption = "Buttons", style = "icon-cursor", Link = "buttons/buttons.html" }, // new NavbarItemModel { Caption = "Buttons Group", style = "icon-cursor", Link = "buttons/button-group.html" }, // new NavbarItemModel { Caption = "Dropdowns", style = "icon-cursor", Link = "buttons/dropdowns.html" }, // new NavbarItemModel { Caption = "Brand Buttons", style = "icon-cursor", Link = "buttons/brand-buttons.html" }, // } //}); //menuList.Add(new NavbarItemModel { Caption = "Charts", style = "icon-pie-chart", Link= "charts.html" }); //menuList.Add(new NavbarItemModel //{ // ItemType = NavbarItemType.DropDown, // Caption = "Icons", // style = "icon-star", // Children = new List<NavbarItemModel>() // { // new NavbarItemModel { Caption = "CoreUI Icons", style = "icon-star", Link = "icons/coreui-icons.html" }, // new NavbarItemModel { Caption = "Flags", style = "icon-star", Link = "icons/flags.html" }, // new NavbarItemModel { Caption = "Font Awesome", style = "icon-star", Link = "icons/font-awesome.html" }, // new NavbarItemModel { Caption = "Simple Line Icons", style = "icon-star", Link = "icons/simple-line-icons.html" } // } //}); //menuList.Add(new NavbarItemModel //{ // ItemType = NavbarItemType.DropDown, // Caption = "Notifications", // style = "icon-bell", // Children = new List<NavbarItemModel>() // { // new NavbarItemModel { Caption = "Alerts", style = "icon-bell", Link = "notifications/alerts.html" }, // new NavbarItemModel { Caption = "Badge", style = "icon-bell", Link = "notifications/badge.html" }, // new NavbarItemModel { Caption = "Modals", style = "icon-bell", Link = "notifications/modals.html" } // } //}); //menuList.Add(new NavbarItemModel { Caption = "Widgets", style = "icon-calculator", Link = "widgets.html" }); //menuList.Add(new NavbarItemModel { Caption = "Widgets", ItemType=NavbarItemType.TextOnly }); menuList.Add(new NavbarItemModel { Caption = "程序员长春", style = "icon-cloud-download", Link = "https://www.jianshu.com/u/15de06e8d059", Target = "_blank", StyleLi = "mt-auto", StyleHref = "nav-link-primary" }); //menuList.Add(new NavbarItemModel { Caption = "Try CoreUI", style = "icon-layers", Link = "https://coreui.io/pro/", StyleHref = "nav-link-danger" }); MainMenus.MenuItems = menuList; return(MainMenus); }