Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Age")] Owner owner)
        {
            if (ModelState.IsValid)
            {
                _context.Add(owner);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(owner));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Brand,Model,Year,Color")] Car car)
        {
            if (ModelState.IsValid)
            {
                _context.Add(car);
                await _context.SaveChangesAsync();

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