public ActionResult CreateThreeLevel(ThreeLevelModel tm) { OneLevelModel oneid = new OneLevelModel() { first_kind_id = tm.first_kind_id }; TwoLevelModel twoid = new TwoLevelModel() { second_kind_id = tm.second_kind_id }; List <OneLevelModel> list = tb1.SeleteByx(oneid); List <TwoLevelModel> list2 = tb2.SeleteByx(twoid); ThreeLevelModel tm2 = new ThreeLevelModel() { first_kind_id = tm.first_kind_id, first_kind_name = list[0].first_kind_name, second_kind_id = tm.second_kind_id, second_kind_name = list2[0].second_kind_name, third_kind_id = tm.third_kind_id, third_kind_is_retail = tm.third_kind_is_retail, third_kind_name = tm.third_kind_name, third_kind_sale_id = tm.third_kind_sale_id }; int num = tb.Add(tm2); if (num > 0) { return(RedirectToAction("ThreeLevel_Create_success")); } else { return(View()); } }
public ActionResult Create(ThreeLevelModel tm) { FirstName(); SecondName(); seleitem(); return(View()); }
public int Delete(ThreeLevelModel c) { ThreeLevel oe = new ThreeLevel() { Id = c.Id }; return(Delete(oe)); }
public ActionResult Edit(ThreeLevelModel tm) { int num = tb.Update(tm); if (num > 0) { return(RedirectToAction("ThreeLevel_Change_success")); } else { ViewBag.dt = tm; return(View()); } }
public int Update(ThreeLevelModel c) { ThreeLevel oe = new ThreeLevel() { Id = c.Id, first_kind_id = c.first_kind_id, first_kind_name = c.first_kind_name, second_kind_id = c.second_kind_id, second_kind_name = c.second_kind_name, third_kind_id = c.third_kind_id, third_kind_is_retail = c.third_kind_is_retail, third_kind_name = c.third_kind_name, third_kind_sale_id = c.third_kind_sale_id }; return(Update(oe)); }
public ActionResult Edit(string id) { seleitem(); ThreeLevelModel om = new ThreeLevelModel() { Id = int.Parse(id) }; List <ThreeLevelModel> list = tb.SeleteBys(om); ThreeLevelModel oo = new ThreeLevelModel() { Id = list[0].Id, first_kind_id = list[0].first_kind_id, first_kind_name = list[0].first_kind_name, second_kind_id = list[0].second_kind_id, second_kind_name = list[0].second_kind_name, third_kind_sale_id = list[0].third_kind_sale_id, third_kind_is_retail = list[0].third_kind_is_retail, third_kind_id = list[0].third_kind_id, third_kind_name = list[0].third_kind_name }; return(View(oo)); }
List <ThreeLevelModel> IThreeLevelDao.QueryAll() { List <ThreeLevel> list = QueryAll(); List <ThreeLevelModel> list2 = new List <ThreeLevelModel>(); foreach (ThreeLevel item in list) { ThreeLevelModel om = new ThreeLevelModel() { Id = item.Id, first_kind_id = item.first_kind_id, first_kind_name = item.first_kind_name, second_kind_id = item.second_kind_id, second_kind_name = item.second_kind_name, third_kind_id = item.third_kind_id, third_kind_sale_id = item.third_kind_sale_id, third_kind_name = item.third_kind_name, third_kind_is_retail = item.third_kind_is_retail }; list2.Add(om); } return(list2); }
public List <ThreeLevelModel> SeleteBys(ThreeLevelModel om) { List <ThreeLevel> list = SelectByx(e => e.Id.Equals(om.Id)); List <ThreeLevelModel> list2 = new List <ThreeLevelModel>(); foreach (ThreeLevel item in list) { ThreeLevelModel oo = new ThreeLevelModel() { Id = item.Id, first_kind_id = item.first_kind_id, first_kind_name = item.first_kind_name, second_kind_id = item.second_kind_id, second_kind_name = item.second_kind_name, third_kind_id = item.third_kind_id, third_kind_sale_id = item.third_kind_sale_id, third_kind_name = item.third_kind_name, third_kind_is_retail = item.third_kind_is_retail }; list2.Add(oo); } return(list2); }
public ActionResult Delete(string id) { try { ThreeLevelModel od = new ThreeLevelModel() { Id = int.Parse(id) }; int num = tb.Delete(od); if (num > 0) { return(Content("ok")); } else { return(Content("on")); } } catch { return(View()); } }
public int Update(ThreeLevelModel c) { return(td.Update(c)); }
public List <ThreeLevelModel> SeleteBys(ThreeLevelModel om) { return(td.SeleteBys(om)); }
public int Delete(ThreeLevelModel c) { return(td.Delete(c)); }
public int Add(ThreeLevelModel c) { return(td.Add(c)); }