public ActionResult Create(ViewYogaArtClass model) { try { // TODO: Add insert logic here if (!string.IsNullOrEmpty(Request.Form["TwoParentID"])) { model.ParentID = Convert.ToInt32(Request.Form["TwoParentID"]); } else { if (model.ParentID == null) { model.ParentID = 0; } } model.CreateTime = DateTime.Now; model.Creator = "admin"; model.IsDelete = 0; client.Add(model); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(ViewYogaArtClass model) { try { // TODO: Add update logic here int ParentID = 0; if (!string.IsNullOrEmpty(Request.Form["hidTwoid"])) { ParentID = Convert.ToInt32(Request.Form["hidTwoid"]); } else { if (!string.IsNullOrEmpty(Request.Form["hidTopid"])) { ParentID = Convert.ToInt32(Request.Form["hidTopid"]); } } ViewYogaArtClass entity = client.GetById(model.ID); if (entity != null) { model.ID = entity.ID; model.ParentID = ParentID; model.CreateTime = entity.CreateTime; model.Creator = entity.Creator; model.IsDelete = entity.IsDelete; client.Update(model); } return(RedirectToAction("Index")); } catch { return(View()); } }
// // GET: /Manage/YogaArtClass/Edit/5 public ActionResult Edit(int id, int parentID) { list = client.GetYogaArtClassPageList(0); ViewYogaArtClass model = client.GetById(id); ViewYogaArtClass modelUp = client.GetById(model.ParentID.Value); if (modelUp != null) { if (modelUp.ParentID != 0) { //三级 ViewYogaArtClass modelthree = client.GetById(model.ParentID.Value); ViewBag.TopParentID = new SelectList(list, "ID", "ClassName", modelthree.ParentID); } else { //二级 ViewBag.TopParentID = new SelectList(list, "ID", "ClassName", modelUp.ID); } } else { //二级 ViewBag.TopParentID = new SelectList(list, "ID", "ClassName", model.ID); } return(View(model)); }
// // GET: /Manage/YogaArticle/Details/5 public ActionResult Details(int id) { ViewYogaArticle model = client.GetById(id); ViewYogaArtClass entity = clientClass.GetById(model.ClassID); if (entity != null) { if (entity.ParentID != 0) { ViewYogaArtClass entity2 = clientClass.GetById(entity.ParentID.Value); if (entity2.ParentID != 0) { ViewYogaArtClass entity3 = clientClass.GetById(entity2.ParentID.Value); ViewBag.ClassName = entity3.ClassName; } else { ViewBag.ClassName = entity2.ClassName; } } else { ViewBag.ClassName = entity.ClassName; } } return(View(model)); }
public int Update(ViewYogaArtClass model) { try { return(YogaArtClassServiceImpl.Update(model)); } catch (Exception ex) { throw ex; } }
public List <ViewYogaArtClass> GetYogaArtClassPageList(int ParentID) { List <YogaArtClass> list = Repository.GetYogaArtClassPageList(ParentID); List <ViewYogaArtClass> model = new List <ViewYogaArtClass>(); foreach (var item in list) { model.Add(ViewYogaArtClass.ToViewModel(item)); } return(model); }
public List <ViewYogaArtClass> GetYogaArtClassPageList(int page, int pagesize, out int count) { List <YogaArtClass> list = Repository.GetYogaArtClassPageList(page, pagesize, out count); List <ViewYogaArtClass> model = new List <ViewYogaArtClass>(); foreach (var item in list) { model.Add(ViewYogaArtClass.ToViewModel(item)); } return(model); }
public List <ViewYogaArtClass> GetYogaArtClassUid(int id) { List <YogaArtClass> list = Repository.GetYogaArtClassUid(id); List <ViewYogaArtClass> model = new List <ViewYogaArtClass>(); foreach (var item in list) { model.Add(ViewYogaArtClass.ToViewModel(item)); } return(model); }
public ViewYogaArtClass GetYogaArtClassById(int id) { return(ViewYogaArtClass.ToViewModel(Repository.GetYogaArtClassById(id))); }
public int Update(ViewYogaArtClass model) { Repository.updateEntity(ViewYogaArtClass.ToEntity(model)); return(Repository.Save()); }
public int Add(ViewYogaArtClass model) { Repository.Add(ViewYogaArtClass.ToEntity(model)); return(Repository.Save()); }
public ViewYogaArtClass GetYogaArtClassByClassName(string ClassName) { return(ViewYogaArtClass.ToViewModel(Repository.GetYogaArtClassByClassName(ClassName))); }