public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerName,CountryListId")] Customerlist customerlist)
        {
            if (id != customerlist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customerlist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerlistExists(customerlist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryListId"] = new SelectList(_context.Countrylist, "Id", "CountryName", customerlist.CountryListId);
            return(View(customerlist));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CountryName")] Countrylist countrylist)
        {
            if (id != countrylist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(countrylist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountrylistExists(countrylist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(countrylist));
        }