Example #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Code,Name")] SystemCountryCodes systemCountryCodes)
        {
            if (id != systemCountryCodes.Code)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(systemCountryCodes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SystemCountryCodesExists(systemCountryCodes.Code))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemCountryCodes));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Code,Name")] SystemCountryCodes systemCountryCodes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(systemCountryCodes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemCountryCodes));
        }