/// <summary> /// 菜单导航 /// </summary> protected void GetAllMenus() { YogaMenusServiceClient menusclient = new YogaMenusServiceClient(); List <ViewYogaMenus> menus = menusclient.GetMenusList(); ViewBag.Menus = menus; }
// // GET: /Manage/Menus/Delete/5 public ActionResult Delete(int id) { using (YogaMenusServiceClient client = new YogaMenusServiceClient()) { client.DelByid(id); } return(RedirectToAction("Index")); }
// // GET: /Manage/Menus/Edit/5 public ActionResult Edit(int id) { ViewYogaMenus menu = new ViewYogaMenus(); using (YogaMenusServiceClient client = new YogaMenusServiceClient()) { menu = client.GetMenusByid(id); } return(View(menu)); }
// // GET: /Manage/Menus/ public ActionResult Index(int page = 1) { List <ViewYogaMenus> list = new List <ViewYogaMenus>(); int count = 0; using (YogaMenusServiceClient client = new YogaMenusServiceClient()) { list = client.GetMenusList(page, 10, out count); } PagedList <ViewYogaMenus> pagelist = new PagedList <ViewYogaMenus>(list, page, 10, count); return(View(pagelist)); }
public ActionResult Create(ViewYogaMenus model) { try { // TODO: Add insert logic here using (YogaMenusServiceClient client = new YogaMenusServiceClient()) { client.Add(model); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, ViewYogaMenus menus) { try { // TODO: Add update logic here ViewYogaMenus menu = new ViewYogaMenus(); using (YogaMenusServiceClient client = new YogaMenusServiceClient()) { menu = client.GetMenusByid(id); menu.name = menus.name; client.Update(menu); } return(RedirectToAction("Index")); } catch { return(View()); } }