public int CreateNewProblem([FromBody] ExpertChoicesModels.Problem problemModel) { _currentUser = AuthHelper.GetUserFromAuthHeader(Request); if (!AuthHelper.VerifyUserAuthorizedExpert(_currentUser)) { return(-1); } return(DbHelper.CreateProblem(ModelMapper.ConvertToDBProblem(problemModel))); }
public void Setup() { #region Test data //Admin expert1 = new ExpertChoicesModels.Expert { Id = 1, Name = "Sonya" }; expert2 = new ExpertChoicesModels.Expert { Id = 2, Name = "Misha" }; expert3 = new ExpertChoicesModels.Expert { Id = 3, Name = "Eva" }; //Analytic problem = new ExpertChoicesModels.Problem { Name = "When to go to cinema" }; alt1 = new ExpertChoicesModels.Alternative { Id = 7, Name = "А1", Description = "Описание 1" }; alt2 = new ExpertChoicesModels.Alternative { Id = 8, Name = "А2", Description = "Описание 2" }; alt3 = new ExpertChoicesModels.Alternative { Id = 9, Name = "А3", Description = "Описание 3" }; //Experts expEstimations1 = new Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Expert> { Estimator = expert1, Estimated = new Dictionary <ExpertChoicesModels.Expert, int?> { { expert2, 4 }, { expert3, 8 }, } }; expEstimations2 = new Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Expert> { Estimator = expert2, Estimated = new Dictionary <ExpertChoicesModels.Expert, int?> { { expert1, 4 }, { expert3, 6 }, } }; expEstimations3 = new Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Expert> { Estimator = expert3, Estimated = new Dictionary <ExpertChoicesModels.Expert, int?> { { expert1, 5 }, { expert2, 7 }, } }; altEstimations1 = new Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Alternative> { Estimator = expert1, Estimated = new Dictionary <ExpertChoicesModels.Alternative, int?> { { alt1, 4 }, { alt2, 5 }, { alt3, 8 } } }; altEstimations2 = new Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Alternative> { Estimator = expert2, Estimated = new Dictionary <ExpertChoicesModels.Alternative, int?> { { alt1, 5 }, { alt2, 6 }, { alt3, 7 } } }; altEstimations3 = new Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Alternative> { Estimator = expert3, Estimated = new Dictionary <ExpertChoicesModels.Alternative, int?> { { alt1, 8 }, { alt2, 5 }, { alt3, 4 } } }; //Server problem.AlternativesEstimations = new List <Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Alternative> > { altEstimations1, altEstimations2, altEstimations3 }; problem.ExpertsEstimations = new List <Estimation <ExpertChoicesModels.Expert, ExpertChoicesModels.Expert> > { expEstimations1, expEstimations2, expEstimations3 }; #endregion }