示例#1
0
        public ActionResult AddComment(Peanut peanut, PeanutCommentCreateCommand peanutCommentCreateCommand, User currentUser)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Show", new { peanut = peanut.BusinessId }));
            }

            PeanutService.AddComment(peanut,
                                     peanutCommentCreateCommand.Comment,
                                     new PeanutUpdateNotificationOptions(peanutCommentCreateCommand.SendUpdateNotification,
                                                                         Url.Action("Show", "Peanut", new { peanut = peanut.BusinessId }, Request.Url.Scheme)),
                                     currentUser);
            return(RedirectToAction("Show", new { peanut = peanut.BusinessId }));
        }