예제 #1
0
        public void MarkBest(MarkBestSolution markBestSolution)
        {
            var previousBest = Db.FirstOrDefault <Models.DataModels.Solution>("WHERE [QuestionId] = @0 AND [BestSolution] = 1", markBestSolution.QuestionId);

            if (previousBest != null)
            {
                if (previousBest.Id != markBestSolution.Id)
                {
                    previousBest.BestSolution = false;
                    Db.Update(previousBest);
                }
            }
            var currentBest = Db.FirstOrDefault <Models.DataModels.Solution>("WHERE [Id] = @0", markBestSolution.Id);

            currentBest.BestSolution = true;
            Db.Update(currentBest);
        }
예제 #2
0
 public void MarkBest([FromBody] MarkBestSolution markBestSolution)
 {
     SolutionService.MarkBest(markBestSolution);
 }