public IActionResult Create([Bind("Id,BuyerName,BuyerAccountNumber")] Buyer buyer)
 {
     if (ModelState.IsValid)
     {
         _context.Add(buyer);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(buyer));
 }
 public IActionResult Create([Bind("Id,ProductName,StartingPrice,IsSold")] Product product)
 {
     if (ModelState.IsValid)
     {
         _context.Add(product);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(product));
 }
예제 #3
0
 //Adds the seller to the databse.
 public IActionResult Create([Bind("Id,SellerName,ContactNumber")] Seller seller)
 {
     if (ModelState.IsValid)
     {
         _context.Add(seller);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(seller));
 }
 public IActionResult Create([Bind("Id,ProductId,BuyerId,SellerId,BidPrice")] Bid bid)
 {
     if (ModelState.IsValid)
     {
         _context.Add(bid);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["BuyerId"]   = new SelectList(_context.Set <Buyer>(), "Id", "BuyerAccountNumber", bid.BuyerId);
     ViewData["ProductId"] = new SelectList(_context.Set <Product>(), "Id", "ProductName", bid.ProductId);
     ViewData["SellerId"]  = new SelectList(_context.Set <Seller>(), "Id", "SellerName", bid.SellerId);
     return(View(bid));
 }