/// <summary> /// MVC post method for update decision /// </summary> /// <param name="dmvm">Decision view model with regarding information</param> /// <returns>updated decision view</returns> public ActionResult UpdateDecision(DecisionModelVM dmvm) { IssueDecision id = new IssueDecision(); DecisionModel decisionModel = new DecisionModel(); decisionModel.AlternativeId = dmvm.AlternativeId; decisionModel.ChangeDate = dmvm.ChangeDate; decisionModel.Explanation = dmvm.Explanation; decisionModel.IssueId = dmvm.IssueId; id.UpdateDecision(decisionModel, GetUserIdFromClaim()); int issueId = decisionModel.IssueId; int userId = GetUserIdFromClaim(); DecisionVM dvm = new DecisionVM(); IssueCreating ic = new IssueCreating(); dvm.OldDecisions = id.GetOldDecisions(issueId, userId); dvm.Decision = id.GetDecision(issueId, userId); dvm.Issue = ic.GetIssue(issueId); var ctx2 = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); ctx2.Clients.All.decisionUpdated(dvm, issueId); return(RedirectToAction("Decision", "Issue", new { issueId = decisionModel.IssueId })); }
/// <summary> /// MVC get method for decide view (Decision.cshtml) /// </summary> /// <param name="issueId">issue id</param> /// <returns>decide view (Decision.cshtml)</returns> public ActionResult Decision(int issueId) { DecisionVM dvm = new DecisionVM(); IssueCreating ic = new IssueCreating(); IssueBrAlternative iba = new IssueBrAlternative(); IssueDecision id = new IssueDecision(); int userId = GetUserIdFromClaim(); dvm.AccessRight = ic.AccessRightOfUserForIssue(userId, issueId).Right; dvm.Alternatives = iba.GetIssueAlternatives(issueId, userId).OrderByDescending(x => x.Rating).ToList(); dvm.Issue = ic.GetIssue(issueId); if (dvm.Issue.Status == "CREATING" || dvm.Issue.Status == "BRAINSTORMING1" || dvm.Issue.Status == "BRAINSTORMING2" || dvm.Issue.Status == "EVALUATING") { return(RedirectToAction("Creating", "Issue", new { issueId = issueId })); } dvm.OldDecisions = id.GetOldDecisions(issueId, userId); dvm.Decision = id.GetDecision(issueId, userId); dvm.UserId = GetUserIdFromClaim(); return(View(dvm)); }