public async Task <IActionResult> Edit() { try { if (QueryParameters.Length > 0) { Guid id = Guid.Parse(QueryParameters[0]); if (id != null) { SideMenuFormLabel _localLabel = await Localize <SideMenuFormLabel>(LocalizePathForm); ViewBag.LocalLabel = _localLabel; ViewData["Title"] = _localLabel.UpdateTitle; ViewData["BtnValue"] = _localLabel.UpdateBtnLabel; AddJS("SideMenu", "/js/SideMenu/SideMenu.js"); await SetDropDown(); SideMenuManager mgr = new SideMenuManager(); var menu = await mgr.GetByID(id, GetSiteID); return(View("Create", menu)); } } return(RedirectToAction(nameof(Index))); } catch (Exception) { throw; } }
public async Task <IActionResult> Create() { try { AddJS("SideMenu", "/js/SideMenu/SideMenu.js"); SideMenuFormLabel _localLabel = await Localize <SideMenuFormLabel>(LocalizePathForm); ViewBag.LocalLabel = _localLabel; ViewData["Title"] = _localLabel.CreateTitle; ViewData["BtnValue"] = _localLabel.AddBtnLabel; await SetDropDown(); return(View(new DashboardSideMenu())); } catch (Exception) { throw; } }
public async Task <IActionResult> AddUpdate(DashboardSideMenu SideMenu) { try { if (ModelState.IsValid) { SideMenuManager mgr = new SideMenuManager(); OperationStatus status = await mgr.AddUpdateMenu(SideMenu, GetUsername, GetSiteID); if (status.IsSuccess) { return(RedirectToAction(nameof(Index))); } } SideMenuFormLabel _localLabel = await Localize <SideMenuFormLabel>(LocalizePathForm); ViewBag.LocalLabel = _localLabel; if (SideMenu.LinkID == null) { ViewData["Title"] = _localLabel.CreateTitle; ViewData["BtnValue"] = _localLabel.AddBtnLabel; } else { ViewData["Title"] = _localLabel.UpdateTitle; ViewData["BtnValue"] = _localLabel.UpdateBtnLabel; } await SetDropDown(); AddJS("SideMenu", "/js/SideMenu/SideMenu.js"); return(View("Create", SideMenu)); } catch (Exception) { throw; } }