public IActionResult Index() { ViewBag.FormList = _form.GetForms(); ViewBag.PoolList = _pool.GetPools(); ViewBag.CityList = _lookUps.GetCity(); ViewBag.FamilyStatusList = _lookUps.GetFamilyStatus(); ViewBag.GenderList = _lookUps.GetGender(); TblPoolSurvey tblPoolSurvey = new TblPoolSurvey(); tblPoolSurvey.PoolTemplate = new TblPool(); tblPoolSurvey.PoolTemplate.Participant = 20; return(View()); }
public IActionResult Poolstemplates(int page = 1, int pageSize = 5) { var CityList = _lookUps.GetCity(); var FamilyStatusList = _lookUps.GetFamilyStatus(); var GenderList = _lookUps.GetGender(); MyPagedList <TblPool> tblPool = _pool.GetPools(page, pageSize); foreach (var item in tblPool.model) { if (!string.IsNullOrEmpty(item.Gender)) { item.Gender = GenderList.Where(x => x.Id == Convert.ToInt64(item.Gender)).SingleOrDefault().Name; } if (!string.IsNullOrEmpty(item.FamilyStatus)) { item.FamilyStatus = FamilyStatusList.Where(x => x.Id == Convert.ToInt64(item.FamilyStatus)).SingleOrDefault().Name; } if (!string.IsNullOrEmpty(item.CityIds)) { string[] cityIdList = item.CityIds.Split(","); int counter = 0; foreach (var id in cityIdList) { if (counter < 1) { item.CityIds = CityList.Where(x => x.Id == Convert.ToInt64(id)).SingleOrDefault().Name; } else { item.CityIds = item.CityIds + "," + CityList.Where(x => x.Id == Convert.ToInt64(id)).SingleOrDefault().Name; } counter++; } } } ViewBag.list = tblPool; ViewBag.PageSize = pageSize; ViewBag.PageIndex = page; return(View(tblPool.model.ToList())); }