コード例 #1
0
 public IActionResult Create([Bind("Id,BuyerName,BuyerPhoneNumber")] Buyer buyer)
 {
     if (ModelState.IsValid)
     {
         _context.Add(buyer);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(buyer));
 }
コード例 #2
0
 public IActionResult Create([Bind("Id,HouseAddress,HousePrice")] House house)
 {
     if (ModelState.IsValid)
     {
         _context.Add(house);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(house));
 }
コード例 #3
0
 public IActionResult Create([Bind("Id,HouseId,SellerName,SellerPhoneNumber")] Seller seller)
 {
     if (ModelState.IsValid)
     {
         _context.Add(seller);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["HouseId"] = new SelectList(_context.House, "Id", "Id", seller.HouseId);
     return(View(seller));
 }
コード例 #4
0
 public IActionResult Create([Bind("TransactionId,BuyerId,HouseId")] Transaction transaction)
 {
     if (ModelState.IsValid)
     {
         _context.Add(transaction);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["BuyerId"] = new SelectList(_context.Buyer, "Id", "Id", transaction.BuyerId);
     ViewData["HouseId"] = new SelectList(_context.House, "Id", "Id", transaction.HouseId);
     return(View(transaction));
 }