public ActionResult Suggestions(SuggestionsModel myModel) { var symbolId = myModel.symbolId; var currentSuggestions = myModel.currentSuggestions; var first = myModel.first; System.Diagnostics.Debug.WriteLine(first + " AND ID IS " + symbolId + " SIR"); var listOfComp = new List<CompositeSymbol>(); if(first == "true") { CompositeSymbolBLL comp = new CompositeSymbolBLL(); listOfComp = comp.GetAll(); System.Diagnostics.Debug.WriteLine("FILLED LIST WITH ALL COMP SYMBOLS FROM BLL SIR"); } else { foreach(CompositeSymbol co in currentSuggestions) { CompositeSymbolBLL comp = new CompositeSymbolBLL(); listOfComp.Add(comp.GetExaxtComositeSymbolByID(co.compId)); } //listOfComp = currentSuggestions; System.Diagnostics.Debug.WriteLine("NUMBER IS: " + currentSuggestions.Count + ", FILLING LIST WITH LIST IN PARAMETER SIR"); } if(listOfComp.Count == 0) { System.Diagnostics.Debug.WriteLine("VERY EMPTY THIS LIST SIR"); } else { System.Diagnostics.Debug.WriteLine("LIST HAS VALUES SIR"); } CompositeOfBLL compOf = new CompositeOfBLL(); CompositeScoreBLL score = new CompositeScoreBLL(); List<CompositeSymbol> suggestions = new List<CompositeSymbol>(); var lastScore = 0; foreach(CompositeSymbol c in listOfComp) { if (c != null) System.Diagnostics.Debug.WriteLine("COMP SYMBOL DOES EXCIST SIR"); else System.Diagnostics.Debug.WriteLine("COMP SYMBOL DOES NOT EXIST SIR"); var temp = compOf.GetComponentsOf(c); foreach(Symbol s in temp) { if(s.symId == symbolId) { if(score.GetScoreFor(c.compId) >= lastScore) { suggestions.Insert(0, c); lastScore = score.GetScoreFor(c.compId); } else suggestions.Add(c); } } } return Json(suggestions); }
public int IncreaseCompSymbolScore(int id) { CompositeScoreBLL compScore = new CompositeScoreBLL(); return compScore.UpdateScoreFor(id, 1); }