public async Task <IActionResult> AddComment(ProjectCommentPartialViewModel model) { var user = UserModel.GetAuthenticatedUser(User.Identity); model.UserId = user.Email; model.UserIdentifier = user.Id; model.FullName = user.GetFullName(); model.Created = DateTime.UtcNow; model.LastModified = model.Created; model.UserAgent = HttpContext.Request.Headers["User-Agent"].ToString(); if (!string.IsNullOrEmpty(model.Comment)) { await _commentsRepository.SaveAsync(model); var project = await _projectRepository.GetAsync(model.ProjectId); project.LastModified = DateTime.UtcNow; await _projectRepository.UpdateAsync(project); await SendNewCommentNotification(model); UserModel.GenerateStreamsId(_streamsIdRepository, user.Id); } return(RedirectToAction("ProjectDetails", "Project", new { id = model.ProjectId }, "tab_Comments")); }
public async Task <IActionResult> AddComment(ProjectCommentPartialViewModel model) { var user = GetAuthenticatedUser(); model.UserId = user.Email; model.FullName = user.GetFullName(); model.Created = DateTime.UtcNow; model.LastModified = model.Created; await _commentsRepository.SaveAsync(model); return(RedirectToAction("ProjectDetails", "Project", new { id = model.ProjectId })); }
public async Task <IActionResult> AddComment(ProjectCommentPartialViewModel model) { var user = GetAuthenticatedUser(); model.UserId = user.Email; model.FullName = user.GetFullName(); model.Created = DateTime.UtcNow; model.LastModified = model.Created; model.UserAgent = HttpContext.Request.Headers["User-Agent"].ToString(); if (!string.IsNullOrEmpty(model.Comment)) { await _commentsRepository.SaveAsync(model); } return(RedirectToAction("ProjectDetails", "Project", new { id = model.ProjectId, commentsActive = true })); }