public IActionResult Create([Bind("Id,Name,ContactNumber")] Tenant tenant) { if (ModelState.IsValid) { _context.Add(tenant); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(tenant)); }
public IActionResult Create([Bind("Id,HouseOwnerId,HouseAddress")] House house) { if (ModelState.IsValid) { _context.Add(house); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } ViewData["HouseOwnerId"] = new SelectList(_context.Set <HouseOwner>(), "Id", "Id", house.HouseOwnerId); return(View(house)); }
public IActionResult Create([Bind("Id,HouseId,TenantId,RentPerWeek")] Contract contract) { if (ModelState.IsValid) { _context.Add(contract); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } ViewData["HouseId"] = new SelectList(_context.Set <House>(), "Id", "Id", contract.HouseId); ViewData["TenantId"] = new SelectList(_context.Set <Tenant>(), "Id", "Id", contract.TenantId); return(View(contract)); }