コード例 #1
0
        public async Task <IActionResult> Create([Bind("ID,Name")] Wine wine)
        {
            if (ModelState.IsValid)
            {
                _context.Add(wine);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(wine));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,Name,Age,Gender,Email,WineID,RateListID")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

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