public IActionResult Create(Document doc) { if (ModelState["Name"].Errors.Count == 0) { int id = documents.AddDocument(doc.Name, userManager.GetUserId(User)).Id; return(RedirectToAction("Document", new { Id = id })); } return(View()); }