public ActionResult CreateReply(int Id) { var post = _Context.Posts.Single(x => x.Id == Id); var model = new NewReplyNewModel { TopicId = Id, AuthorName = User.Identity.Name, PostName = post.Title }; return(View(model)); }
//[HttpPost] //public async Task<ActionResult> AddPostReply(NewReplyNewModel model) //{ // var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(_Context)); // var name = User.Identity.Name; // var userId = _Context.Users.Single(x => x.UserName == User.Identity.Name).Id; // var user = await manager.FindByIdAsync(userId); // var post = BuildPostReply(model, user); // _Context.Posts.Add(post); // _Context.SaveChanges(); // var newId = _Context.Posts.Single(x => x.Title == post.Title).Id; // return RedirectToAction("Index", "Post", new { Id = newId }); //ovo treba da vratis //} private object BuildPostReply(NewReplyNewModel model, ApplicationUser user) { throw new NotImplementedException(); }