Beispiel #1
0
        public async Task <IActionResult> Edit(string id, [Bind("DistrictGeoCode,DistrictName,DivisionGeoCode")] LookUpAdminBndDistrict lookUpAdminBndDistrict)
        {
            if (id != lookUpAdminBndDistrict.DistrictGeoCode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lookUpAdminBndDistrict);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LookUpAdminBndDistrictExists(lookUpAdminBndDistrict.DistrictGeoCode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DivisionGeoCode"] = new SelectList(_context.LookUpAdminBndDivision, "DivisionGeoCode", "DivisionGeoCode", lookUpAdminBndDistrict.DivisionGeoCode);
            return(View(lookUpAdminBndDistrict));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("DistrictGeoCode,DistrictName,DivisionGeoCode")] LookUpAdminBndDistrict lookUpAdminBndDistrict)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lookUpAdminBndDistrict);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DivisionGeoCode"] = new SelectList(_context.LookUpAdminBndDivision, "DivisionGeoCode", "DivisionGeoCode", lookUpAdminBndDistrict.DivisionGeoCode);
            return(View(lookUpAdminBndDistrict));
        }