private void SetResignTypeList(int?type, bool allowBlank = true) { IResignTypeService cs = new ResignTypeService(Settings.Default.db); ResignTypeSearchModel csm = new ResignTypeSearchModel(); List <ResignType> certType = cs.Search(csm).ToList(); List <SelectListItem> select = new List <SelectListItem>(); if (allowBlank) { select.Add(new SelectListItem { Text = "", Value = "" }); } foreach (var certt in certType) { if (type.HasValue && type.ToString().Equals(certt.id)) { select.Add(new SelectListItem { Text = certt.name, Value = certt.id.ToString(), Selected = true }); } else { select.Add(new SelectListItem { Text = certt.name, Value = certt.id.ToString(), Selected = false }); } } ViewData["resignTypeList"] = select; }
public ActionResult Search([Bind(Include = "Name")] ResignTypeSearchModel q) { int pageIndex = 0; int.TryParse(Request.QueryString.Get("page"), out pageIndex); pageIndex = PagingHelper.GetPageIndex(pageIndex); IResignTypeService ss = new ResignTypeService(Settings.Default.db); IPagedList <ResignType> resignTypes = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; return(View("Index", resignTypes)); }
public ActionResult Index(int?page) { int pageIndex = PagingHelper.GetPageIndex(page); ResignTypeSearchModel q = new ResignTypeSearchModel(); IResignTypeService ss = new ResignTypeService(Settings.Default.db); IPagedList <ResignType> resignTypes = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize); ViewBag.Query = q; ResignTypeInfoModel info = ss.GetResignTypeInfo(q); ViewBag.Info = info; return(View(resignTypes)); }