Example #1
0
        public async Task <ActionResult> AddComment(CommentViewModel comment, int companyId,
                                                    string redirectAction, string redirectController)
        {
            if (ModelState.IsValid)
            {
                var userId         = User.GetClaimValue(UserIdClaim);
                var createdComment = await _newsRepository.AddComment(comment, userId);

                _notificationService.Create(NotificationType.Bells, EventType.CommentCreated, createdComment.Id);
            }

            if (!string.IsNullOrEmpty(redirectAction) && !string.IsNullOrEmpty(redirectController))
            {
                return(RedirectToAction(redirectAction, redirectController));
            }
            else
            {
                return(RedirectToAction("Details", "Business", new { id = companyId }));
            }
        }