public async Task <IActionResult> Edit(int id, [Bind("UserId,UserName")] User user) { if (id != user.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("LogItemId,LogItemDescription,LogItemPoints,CategoryId")] LogItem logItem) { if (id != logItem.LogItemId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(logItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LogItemExists(logItem.LogItemId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryName", logItem.CategoryId); return(View(logItem)); }
public async Task <IActionResult> Edit(int id, [Bind("LogId,LogDate,UserId,LogItemId")] Log log) { if (id != log.LogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(log); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LogExists(log.LogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LogItemId"] = new SelectList(_context.LogItems, "LogItemId", "LogItemDescription", log.LogItemId); ViewData["UserId"] = new SelectList(_context.Users, "UserId", "UserName", log.UserId); return(View(log)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryId,CategoryName")] Category category) { if (id != category.CategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }