public async Task <IActionResult> Edit(int id, [Bind("UserId,Name,Address,City,State,Zipcode,Phone,SaleId,ApplicationUserId")] RummageUser rummageUser) { if (id != rummageUser.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rummageUser); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RummageUserExists(rummageUser.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.Set <ApplicationUser>(), "Id", "Id", rummageUser.ApplicationUserId); return(View(rummageUser)); }
public async Task <IActionResult> Create([Bind("UserId,Name,Address,City,State,Zipcode,Phone,SaleId,ApplicationUserId")] RummageUser rummageUser) { if (ModelState.IsValid) { rummageUser.ApplicationUserId = _userManager.GetUserId(HttpContext.User); _context.Add(rummageUser); await _context.SaveChangesAsync(); return(RedirectToAction("Details")); } ViewData["ApplicationUserId"] = new SelectList(_context.Set <ApplicationUser>(), "Id", "Id", rummageUser.ApplicationUserId); return(View(rummageUser)); }