public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email")] Buyer buyer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(buyer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(buyer));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Name,Description,SellerId")] Item item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SellerId"] = new SelectList(_context.Sellers, "Id", "FirstName", item.SellerId);
            return(View(item));
        }