public ActionResult BaseTypeDel(int id) { PdBasetypeBll bll = new PdBasetypeBll(); PD_BASETYPE model = bll.Query(t => t.Id == id).FirstOrDefault(); if (model != null) { bll.Delete(model, true); } return(Json(BaseModels.OK("成功!"))); }
public ActionResult BaseTypeEdit(int?id) { PD_BASETYPE bType = new PD_BASETYPE(); if (id.ToInt() > 0) { PdBasetypeBll bll = new PdBasetypeBll(); bType = bll.Query(t => t.Id == id).FirstOrDefault(); } return(View(bType)); }
public ActionResult BaseTypeEdit(PD_BASETYPE model) { PdBasetypeBll bll = new PdBasetypeBll(); PD_BASETYPE bType = bll.Query(t => t.Id == model.Id).FirstOrDefault(); if (bType == null) { bType = model; bll.Add(bType); } else { bType.Name = model.Name; bType.Remark = model.Remark; bll.Update(bType); } ViewBag.Success = true; ViewBag.Message = "修改成功!"; return(View(bType)); }
public ActionResult BaseTypeList(int?page, int?count, string keyword) { page = page.ToInt() == 0 ? 1 : page; count = count.ToInt() == 0 ? 10 : count; var predicate = PredicateBuilder.New <PD_BASETYPE>(true); if (!string.IsNullOrEmpty(keyword)) { ViewBag.Keyword = keyword; predicate = predicate.And(t => t.Name.Contains(keyword)); } PdBasetypeBll bll = new PdBasetypeBll(); int total = 0; List <PD_BASETYPE> allKefu = bll.QueryByPage(page.ToInt(), count.ToInt(), out total, predicate, t => t.Id, false); ViewBag.Total = total; ViewBag.PageIndex = page; ViewBag.PageCount = count; return(View(allKefu)); }