Пример #1
0
        public async Task SaveComment(CommentAddModel commentModel)
        {
            USER user = await _userRepository.GetUserByContext(HttpContext.User);

            if (_teamRepository.IsTeamMember(user, commentModel.TeamId) && _permissionService.CheckPermissionToCommentTasks(user, commentModel.TeamId))
            {
                _taskService.AddCommentToTask(commentModel, user);
            }
        }
Пример #2
0
        public async Task <IActionResult> LeaveComment(string text)
        {
            var added = await _taskService.AddCommentToTask(text, CurrentUserService.currentUserId, _taskId);

            if (!added)
            {
                return(RedirectToAction("Index", new { taskId = _taskId }));
            }
            var task = await _taskService.FindTaskById(_taskId);

            foreach (var user in task.AssignedUsers)
            {
                if (user.Id == CurrentUserService.currentUserId)
                {
                    continue;
                }
                await _notificationService.FormNotification($"A new comment was left under the task \"{task.Title}\"",
                                                            _link, user.Id);
            }

            return(RedirectToAction("Index", new { taskId = _taskId }));
        }