コード例 #1
0
        public async Task <IActionResult> Edit(decimal id, [Bind("Id,Name")] HostVerification hostVerification)
        {
            if (id != hostVerification.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hostVerification);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HostVerificationExists(hostVerification.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hostVerification));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] HostVerification hostVerification)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hostVerification);
                await _context.SaveChangesAsync();

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