public IActionResult Create(PostModel model) { var topic = _topic.GetTopic(model.TopicId); if (topic == null) { return(RedirectToAction("details", "home", new { model.TopicId })); } ViewBag.Topic = topic; if (ModelState.IsValid) { model.UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value; var addReply = _topic.AddReply(model); if (addReply.Succeeded) { return(RedirectToAction("details", "home", new { id = model.TopicId })); } else { ModelState.AddModelError("ServerError", addReply.Message); } } return(View(model)); }