示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Code,Address")] ROMTestModel rOMTestModel)
        {
            if (id != rOMTestModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rOMTestModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ROMTestModelExists(rOMTestModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rOMTestModel));
        }
示例#2
0
        public IActionResult Edit(Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Update(category);
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }