public Dictionary <string, object> Fenye(int pageIndex) { int rows = 0; List <Guanli> list = FenYe <int>(e => e.Id, e => e.Id > 0, ref rows, pageIndex, 3); List <GuanliModel> dt = new List <GuanliModel>(); foreach (Guanli item in list) { GuanliModel um = new GuanliModel() { Id = item.Id, gname = item.gname, Explain = item.Explain, Available = item.Available }; dt.Add(um); } //获取总行数 List <Guanli> list3 = db.Guanlis.OrderBy(e => e.Id).Where(e => e.Id > 0).ToList(); rows = list3.Count(); //获取总页数 double page = rows / 3.00; int pages = int.Parse(Math.Ceiling(page).ToString()); Dictionary <string, object> di = new Dictionary <string, object>(); di["dt"] = dt; di["rows"] = rows; di["pages"] = pages; return(di); }
public ActionResult Create(GuanliModel g) { if (gb.Add(g) > 0) { return(Content("<script>alert('新增成功');window.location='Index'</script>")); } else { ViewBag.dt = g; } return(View()); }
public int Update(GuanliModel st) { Guanli est = new Guanli() { Id = st.Id, gname = st.gname, Explain = st.Explain, Available = st.Available }; return(Update(est)); }
public int Add(GuanliModel st) { //把DTO转为EO Guanli est = new Guanli() { Id = st.Id, gname = st.gname, Explain = st.Explain, Available = st.Available }; return(Add(est)); }
public ActionResult Delete(int id) { GuanliModel s = new GuanliModel { Id = id }; if (gb.Del(s) > 0) { return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }
public List <Model.GuanliModel> Select() { List <Guanli> list = SelectAll(); List <GuanliModel> list2 = new List <GuanliModel>(); foreach (Guanli item in list) { GuanliModel sm = new GuanliModel() { Id = item.Id, gname = item.gname , Explain = item.Explain, Available = item.Available }; list2.Add(sm); } return(list2); }
public List <GuanliModel> SelectBy(GuanliModel st) { List <Guanli> list = SelectBy(e => e.Id.Equals(st.Id)); List <GuanliModel> list2 = new List <GuanliModel>(); foreach (var item in list) { GuanliModel sd = new GuanliModel() { Id = item.Id, gname = item.gname, Explain = item.Explain, Available = item.Available }; list2.Add(sd); } return(list2); }
public ActionResult Create(usersModel u) { GuanliModel gu = new GuanliModel(); usersModel pt = new usersModel() { u_name = u.u_name, u_password = u.u_password, u_true_name = u.u_true_name, Gid = u.Id }; if (us.Add(pt) > 0) { return(Content("<script>alert('新增成功');window.location='Index'</script>")); } else { ViewBag.dt = u; } return(View()); }
public int Update(GuanliModel st) { return(ist.Update(st)); }
public int Del(GuanliModel st) { return(ist.Del(st)); }
public int Add(GuanliModel st) { return(ist.Add(st)); }
public List <GuanliModel> SelectBy(GuanliModel st) { return(ist.SelectBy(st)); }