public HttpResponseMessage MarkCoreInfoAsRead(int issueId, string type) { HttpResponseMessage msg = new HttpResponseMessage(); if (type == "Criterion") { IssueBrCriteria ibc = new IssueBrCriteria(); ibc.MarkAsRead(issueId, GetUserIdFromClaim()); } else if (type == "Alternative") { IssueBrAlternative iba = new IssueBrAlternative(); iba.MarkAsRead(issueId, GetUserIdFromClaim()); } msg.StatusCode = System.Net.HttpStatusCode.OK; return(msg); }
public ActionResult BrCriteria([FromJson] BrCriteriaVM brCriteriaVM) { IssueBrCriteria ibc = new IssueBrCriteria(); ibc.UpdateCriteria(brCriteriaVM.IssueCriteria, brCriteriaVM.DeletedCriteria, GetUserIdFromClaim()); brCriteriaVM.IssueCriteria = ibc.GetIssueCriteria(brCriteriaVM.Issue.Id, GetUserIdFromClaim()); UserShortModel user = new UserShortModel(brCriteriaVM.UserId, GetUserNameFromClaim()); var context = GlobalHost.ConnectionManager.GetHubContext <CriterionHub>(); context.Clients.All.updateCriteria(brCriteriaVM.IssueCriteria, user, brCriteriaVM.Issue.Id); if (brCriteriaVM.DeletedCriteria != null && brCriteriaVM.DeletedCriteria.Count > 0) { context.Clients.All.deleteCriteria(brCriteriaVM.DeletedCriteria, user); } var ctx2 = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); ctx2.Clients.All.updateActivity(brCriteriaVM.Issue.Id, brCriteriaVM.UserId); brCriteriaVM.DeletedCriteria = new List <int>(); return(View(brCriteriaVM)); }
/// <summary> /// http post method for marking comments as read /// </summary> /// <param name="issueId">issue id</param> /// <param name="type">string and possible options are: Issue, Alternative, Criterion</param> /// <returns>Http response message</returns> public HttpResponseMessage MarkCommentsAsRead(int issueId, string type) { HttpResponseMessage msg = new HttpResponseMessage(); int userId = GetUserIdFromClaim(); if (type == "Issue") { IssueCreating ic = new IssueCreating(); ic.MarkCommentsAsRead(issueId, userId); } else if (type == "Alternative") { IssueBrAlternative iba = new IssueBrAlternative(); iba.MarkCommentsAsRead(issueId, userId); } else if (type == "Criterion") { IssueBrCriteria ibc = new IssueBrCriteria(); ibc.MarkCommentsAsRead(issueId, userId); } return(msg); }
public ActionResult BrCriteria(int issueId) { IssueCreating ic = new IssueCreating(); BrCriteriaVM viewModel = new BrCriteriaVM(); int userId = GetUserIdFromClaim(); viewModel.Issue = ic.GetIssue(issueId); if (viewModel.Issue.Status == "CREATING") { return(RedirectToAction("Creating", "Issue", new { issueId = issueId })); } IssueBrCriteria ibc = new IssueBrCriteria(); viewModel.IssueCriteria = ibc.GetIssueCriteria(issueId, userId); viewModel.AccessRight = ic.AccessRightOfUserForIssue(userId, issueId).Right; viewModel.UserId = userId; if (ibc.MarkAsRead(issueId, userId)) { var ctx2 = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); ctx2.Clients.All.updateActivity(issueId, userId); } return(View(viewModel)); }