コード例 #1
0
        public ActionResult CreateBestBet(string keyword, string language)
        {
            var bestBet = new BestBet(keyword, language);

            var isCreated = _bestBetRepository.CreateIfNotExisting(bestBet, x => x.Keyword == keyword && x.Language == language);

            if (isCreated)
            {
                return(Json(bestBet.Id.ExternalId));
            }

            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }
コード例 #2
0
        public void DeleteBestBet(string languageId, string phrase, string id, string index, Type type)
        {
            List <BestBet> bestBets = GetBestBets(languageId, index).ToList();
            BestBet        target   = bestBets.FirstOrDefault(b => b.Phrase == phrase && b.Id == id);

            if (target == null)
            {
                return;
            }

            bestBets.Remove(target);
            var result = bestBets.Where(b => !String.IsNullOrWhiteSpace(b.Phrase));

            SetBestBets(languageId, result.ToArray(), index, type);
            _coreIndexer.ClearBestBets(index, type, id);
        }
コード例 #3
0
 private static string PhraseToRow(BestBet bestBet)
 => $"{bestBet.Phrase}{PhraseDelim}{bestBet.Id}{PhraseDelim}{bestBet.Provider}";
コード例 #4
0
 private static string PhraseToRow(BestBet bestBet)
 {
     return($"{bestBet.Phrase}{PhraseDelim}{bestBet.Id}{PhraseDelim}{bestBet.Provider}");
 }