public ActionResult Reply(ViewModels.ReplyRequest model) { var variant = GameTypeService.GetVariant(model.Id); if (ModelState.IsValid) { int id = GameTypeService.Reply(model, User.Identity.GetUserId <int>()); return(new RedirectResult(Url.Action("Details", new { slug = variant.Slug }) + "#reactions-" + id)); } SetAlert("<strong>PARDON OUR DUST!</strong> Something went wrong when trying to reply, please try again.", AlertType.Danger); return(RedirectToAction("Details", new { slug = variant.Slug })); }
public int Reply(ViewModels.ReplyRequest model, int userId) { var reaction = new Models.Reaction { Comment = model.Comment, AuthorId = userId, GameMapVariantId = model.Id, ParentReactionId = model.ParentId, IsDeleted = false, PostedOn = DateTime.UtcNow }; db.Reactions.Add(reaction); db.SaveChanges(); return(reaction.Id); }