示例#1
0
        public async Task <IActionResult> Create([Bind("Id,PartName,PartCost")] Part part)
        {
            if (ModelState.IsValid)
            {
                _context.Add(part);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(part));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Item item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

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