Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("ID,Name,Gender,Company,Department")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,Name,Color,Age")] Cat cat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cat);
                await _context.SaveChangesAsync();

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