public IActionResult Update(int id) { Index_VM model = new Index_VM() { personel = _db.Personel.GetByID(id), ContactTypes = _PersonelFn.GetContactTypes().Select(k => new SelectListItem() { Text = k, Value = k }).ToList(), Countries = _PersonelFn.GetCountries().Select(k => new SelectListItem() { Text = k, Value = k }).ToList() }; if (model.personel != null) { return(View(model)); } else { return(RedirectToAction("Index")); } }
public async Task <IActionResult> Index() { var listOfAll = new Index_VM() { NationalParkList = await _nationalRepository.GetAllAsync(SD.NationalParkAPIPath), Trails = await TrailRepository.GetAllAsync(SD.TrailAPIPath) }; return(View(listOfAll)); }
public Index_VM GetFilteredModel(string ContactType, string CountryName) { Index_VM model = new Index_VM() { personels = _db.Personel.GetAll().ToList() }; if (ContactType != null) { model.personels = model.personels.Where(k => k.ContactType == ContactType).ToList(); } if (CountryName != null) { model.personels = model.personels.Where(k => k.Country == CountryName).ToList(); } return(model); }
public IActionResult Index() { Index_VM model = new Index_VM() { personels = _db.Personel.GetAll().ToList(), ContactTypes = _PersonelFn.GetContactTypes().Select(k => new SelectListItem() { Text = k, Value = k }).ToList(), Countries = _PersonelFn.GetCountries().Select(k => new SelectListItem() { Text = k, Value = k }).ToList() }; return(View(model)); }
public IActionResult LoadPersonelsByFilter(string ContactType = null, string CountryName = null) { Index_VM model = _PersonelFn.GetFilteredModel(ContactType, CountryName); return(PartialView("Views/Partials/ListPersonels.cshtml", model.personels)); }