コード例 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("ProtocolCode,Description")] Protocol protocol)
        {
            if (id != protocol.ProtocolCode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(protocol);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProtocolExists(protocol.ProtocolCode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(protocol));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string id, [Bind("EnvironmentCode,Description")] Context.Environment environment)
        {
            if (id != environment.EnvironmentCode)
            {
                return(NotFound());
            }

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