public IActionResult Create() { VoteConfigurationCreateViewModel model = new VoteConfigurationCreateViewModel(); GetAllLists(ref model); return(View(model)); }
public IActionResult Create(VoteConfigurationCreateViewModel model) { if (ModelState.IsValid) { var castVC = mapper.Map <VoteConfiguration>(model); castVC.VoteConfigurationUID = Guid.NewGuid(); int result = confrepo.Create(castVC); if (result > 0) { return(RedirectToAction("create")); } } return(View()); }
private void GetAllLists(ref VoteConfigurationCreateViewModel model) { try { model.CountryList = courepo.GetAll().Where(s => s.IsActive == true).ToList(); model.CandidateList = carepo.GetAll().Where(s => s.IsActive == true).ToList(); model.StatesList = strepo.GetAll().Where(s => s.IsActive == true).ToList(); model.DistrictList = disrepo.GetAll().ToList(); model.CityList = cirepo.GetAll().Where(s => s.IsActive == true).ToList(); model.AreaList = arepo.GetAll().Where(s => s.IsActive == true).ToList(); model.WardList = ewardrepo.GetAll().Where(s => s.IsActive == true).ToList(); model.BoothList = borepo.GetAll().Where(s => s.IsActive == true).ToList(); model.KioskList = kioskrepo.GetAll().Where(s => s.IsActive == true).ToList(); model.PoliticalPartyList = db.VW_PoliticalPartiesWithOutNOTA.ToList(); model.ElectionTypeList = typerepo.GetAll().Where(s => s.IsActive == true).ToList(); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); throw new Exception(ex.Message); } }