public ActionResult Create(CascadeDropdownVM vm) { try { var id = vms.OrderByDescending(i => i.Id).Select(i => i.Id).FirstOrDefault(); vm.Id = ++id; vms.Add(vm); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, CascadeDropdownVM vm) { try { var locSource = vms.Where(i => i.Id == id).SingleOrDefault(); locSource.SelectedCountryId = vm.SelectedCountryId; locSource.SelectedStateId = vm.SelectedStateId; locSource.SelectedCityId = vm.SelectedCityId; return RedirectToAction("Index"); } catch { return View(); } }