public async Task <IActionResult> Create([Bind("UserId,UserName")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Create([Bind("CategoryId,CategoryName")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("LogItemId,LogItemDescription,LogItemPoints,CategoryId")] LogItem logItem) { if (ModelState.IsValid) { _context.Add(logItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryName", logItem.CategoryId); return(View(logItem)); }
public async Task <IActionResult> Create([Bind("LogId,LogDate,UserId,LogItemId")] Log log) { if (ModelState.IsValid) { _context.Add(log); await _context.SaveChangesAsync(); 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)); }