public async Task <IActionResult> Edit(int id, [Bind("Id,LifeJoyExpl,CurrentStatusId")] PersonalLyfeJoy personalLyfeJoy) { if (id != personalLyfeJoy.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(personalLyfeJoy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonalLyfeJoyExists(personalLyfeJoy.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CurrentStatusId"] = new SelectList(_context.CurrentStatuses, "Id", "StatusName", personalLyfeJoy.CurrentStatusId); return(View(personalLyfeJoy)); }
public async Task <IActionResult> Create([Bind("Id,LifeJoyExpl,CurrentStatusId")] PersonalLyfeJoy personalLyfeJoy) { if (ModelState.IsValid) { _context.Add(personalLyfeJoy); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CurrentStatusId"] = new SelectList(_context.CurrentStatuses, "Id", "StatusName", personalLyfeJoy.CurrentStatusId); return(View(personalLyfeJoy)); }