Exemple #1
0
        public async Task <IActionResult> Add([Bind("Id,CountryName")] Countrylist countrylist)
        {
            if (ModelState.IsValid)
            {
                _context.Add(countrylist);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(countrylist));
        }
        public async Task <IActionResult> Add([Bind("Id,CustomerName,CountryListId")] Customerlist customerlist)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customerlist);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryListId"] = new SelectList(_context.Countrylist, "Id", "CountryName", customerlist.CountryListId);
            return(View(customerlist));
        }