public async Task <IActionResult> Edit(string id, [Bind("UnionGeoCode,UnionName,DistrictGeoCode,UpazilaGeoCode")] LookUpAdminBndUnion lookUpAdminBndUnion) { if (id != lookUpAdminBndUnion.UnionGeoCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lookUpAdminBndUnion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LookUpAdminBndUnionExists(lookUpAdminBndUnion.UnionGeoCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DistrictGeoCode"] = new SelectList(_context.LookUpAdminBndDistrict, "DistrictGeoCode", "DistrictGeoCode", lookUpAdminBndUnion.DistrictGeoCode); ViewData["UpazilaGeoCode"] = new SelectList(_context.LookUpAdminBndUpazila, "UpazilaGeoCode", "UpazilaGeoCode", lookUpAdminBndUnion.UpazilaGeoCode); return(View(lookUpAdminBndUnion)); }
public async Task <IActionResult> Create([Bind("UnionGeoCode,UnionName,DistrictGeoCode,UpazilaGeoCode")] LookUpAdminBndUnion lookUpAdminBndUnion) { if (ModelState.IsValid) { _context.Add(lookUpAdminBndUnion); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DistrictGeoCode"] = new SelectList(_context.LookUpAdminBndDistrict, "DistrictGeoCode", "DistrictGeoCode", lookUpAdminBndUnion.DistrictGeoCode); ViewData["UpazilaGeoCode"] = new SelectList(_context.LookUpAdminBndUpazila, "UpazilaGeoCode", "UpazilaGeoCode", lookUpAdminBndUnion.UpazilaGeoCode); return(View(lookUpAdminBndUnion)); }