public ActionResult Evaluation([FromJson] EvaluationVM evaluationVM) { IssueEvaluation ie = new IssueEvaluation(); ie.SaveUserRatings(evaluationVM.UserRatings); List <RatingModel> userRatings = new List <RatingModel>(); for (int i = 0; i < evaluationVM.UserRatings.Count(); i++) { foreach (RatingModel rat in evaluationVM.UserRatings[i]) { userRatings.Add(rat); } } var context = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); context.Clients.All.updateRatings(userRatings, new UserShortModel(evaluationVM.UserId, GetUserNameFromClaim())); var ctx2 = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); ctx2.Clients.All.updateActivity(evaluationVM.Issue.Id, evaluationVM.UserId); return(View(evaluationVM)); }
/// <summary> /// MVC get method for alternatives evaluation (Evaulation.cshtml) /// </summary> /// <param name="issueId">issue id</param> /// <returns>alternatives evaluation view (Evaulation.cshtml)</returns> public ActionResult Evaluation(int issueId) { IssueCreating ic = new IssueCreating(); EvaluationVM evm = new EvaluationVM(); IssueEvaluation ie = new IssueEvaluation(); int userId = GetUserIdFromClaim(); evm.Issue = ic.GetIssue(issueId); if (evm.Issue.Status == "CREATING" || evm.Issue.Status == "BRAINSTORMING1" || evm.Issue.Status == "BRAINSTORMING2") { return(RedirectToAction("Creating", "Issue", new { issueId = issueId })); } //ToDo check viewsettings & issueOwner evm.AllRatings = ie.GetAllIssueRatings(issueId, userId); evm.UserRatings = ie.GetIssueUserRatings(issueId, userId); evm.Criterias = ie.GetIssueCrtieria(issueId, userId); evm.Alternatives = ie.GetIssueAlternatives(issueId, userId); evm.RatedUsers = ie.GetRatedUsersForIssue(issueId, userId); evm.RatedUserCnt = evm.RatedUsers.Count; evm.AccessRight = ic.AccessRightOfUserForIssue(userId, issueId).Right; evm.UserId = userId; if (evm.Issue.Setting == "B") { IssueCriterionWeight icw = new IssueCriterionWeight(); evm.SliderValues = ie.GetSliderValues(); evm.PairwiseRatings = ie.GetPairwiseAlternativeRatings(issueId, userId); } return(View(evm)); }
public string SaveAlternativeRatingAHP(int issueId, List <PairwiseComparisonRatingModel> list) { IssueEvaluation ie = new IssueEvaluation(); string msg = ie.SaveAHPAlternativeEvaluation(list, issueId, GetUserIdFromClaim()); int userId = GetUserIdFromClaim(); string userName = GetUserNameFromClaim(); List <RatingModel> ratList = ie.GetAllIssueRatings(issueId, userId).Where(x => x.UserId == userId).OrderBy(x => x.CriterionId).ThenBy(x => x.AlternativeId).ToList(); if (msg == "success") { var context = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); context.Clients.All.updateRatings(ratList, new UserShortModel(userId, userName)); var ctx2 = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); ctx2.Clients.All.updateActivity(issueId, userId); } return(msg); }