public async Task <IActionResult> Edit(long id, [Bind("VillageId,VillageCode,VillageName,SubLocationId,CreatedAt")] Village village)
        {
            if (id != village.VillageId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(village);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VillageExists(village.VillageId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubLocationId"] = new SelectList(_context.SubLocations, "SubLocationId", "SubLocationCode", village.SubLocationId);
            return(View(village));
        }
        public async Task <IActionResult> Edit(long id, [Bind("CountyId,CountyCode,CountyName,CreatedAt")] County county)
        {
            if (id != county.CountyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(county);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountyExists(county.CountyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(county));
        }
Example #3
0
        public async Task <IActionResult> Edit(long id, [Bind("ApplicationId,FullName,DateOfBirth,MaritalStatus,IdNumber,County,SubCounty,Location,SubLocation,Village,PostalAddress,PhysicalAddress,PoorElderlyPersons,OrphanAndVulnerableChildren,PersonsWithDisability,PersonsInExtremePoverty,AnyOther,InfoCollectedBy,DesignationOfCollector,DateOfCollection,CreatedAt")] Application application)
        {
            if (id != application.ApplicationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(application);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApplicationExists(application.ApplicationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["County"]      = new SelectList(_context.Counties, "CountyId", "CountyName", application.County);
            ViewData["Location"]    = new SelectList(_context.Locations, "LocationId", "LocationName", application.Location);
            ViewData["SubCounty"]   = new SelectList(_context.SubCounties, "SubCountyId", "SubCountyName", application.SubCounty);
            ViewData["SubLocation"] = new SelectList(_context.SubLocations, "SubLocationId", "SubLocationName", application.SubLocation);
            ViewData["Village"]     = new SelectList(_context.Villages, "VillageId", "VillageName", application.Village);
            return(View(application));
        }
Example #4
0
        public async Task <IActionResult> Edit(long id, [Bind("LocationId,LocationCode,LocationName,SubCountyId,CreatedAt")] Location location)
        {
            if (id != location.LocationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(location);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationExists(location.LocationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubCountyId"] = new SelectList(_context.SubCounties, "SubCountyId", "SubCountyCode", location.SubCountyId);
            return(View(location));
        }
        public async Task <IActionResult> Edit(long id, [Bind("SubCountyId,SubCountyCode,SubCountyName,CountyId,CreatedAt")] SubCounty subCounty)
        {
            if (id != subCounty.SubCountyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subCounty);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubCountyExists(subCounty.SubCountyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountyId"] = new SelectList(_context.Counties, "CountyId", "CountyName", subCounty.CountyId);
            return(View(subCounty));
        }
Example #6
0
        public async Task <IActionResult> Edit(long id, [Bind("TelephoneContactId,TelephoneContact1,ApplicationId,CreatedAt")] TelephoneContact telephoneContact)
        {
            if (id != telephoneContact.TelephoneContactId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telephoneContact);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelephoneContactExists(telephoneContact.TelephoneContactId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationId"] = new SelectList(_context.Applications, "ApplicationId", "FullName", telephoneContact.ApplicationId);
            return(View(telephoneContact));
        }