public async Task <IActionResult> Create([Bind("ID,ImageData, PropertyId")] Photo photo) { if (ModelState.IsValid) { _context.Add(photo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(photo)); }
public async Task <IActionResult> Create([Bind("ID,Street1,Street2,City,State,ZipCode,Neighborhood,SalesPrice,DateListed,Bedrooms,Bathrooms,GarageSize,SquareFeet,LotSize,Description")] Property @property) { if (ModelState.IsValid) { property.OwnerId = _userManager.GetUserId(User); _context.Add(@property); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(@property)); }