public async Task <IActionResult> Create([Bind("ID,Name,Color")] Location location) { if (ModelState.IsValid) { location.UserId = _currentUserId; _context.Add(location); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(location)); }
public async Task <IActionResult> Create([Bind("ID,Name,Color")] Category category) { category.UserId = _currentUserId; if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }