示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Label")] CountryCode countryCode)
        {
            if (id != countryCode.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(countryCode);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryCodeExists(countryCode.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(countryCode));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ComName,Name,SciName,title")] Species species)
        {
            if (id != species.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db_context.Update(species);
                    await db_context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeciesExists(species.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(species));
        }