public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,LifeJoyExpl,JobDate")] LifeJoy lifeJoy) { if (id != lifeJoy.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lifeJoy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LifeJoyExists(lifeJoy.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUser, "Id", "Id", lifeJoy.ApplicationUserId); return(View(lifeJoy)); }
public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,LifeJoyExpl,JobDate")] LifeJoy lifeJoy) { if (ModelState.IsValid) { _context.Add(lifeJoy); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUser, "Id", "Id", lifeJoy.ApplicationUserId); return(View(lifeJoy)); }