public HttpResponseMessage GetWordsList(int dictionaryId, int indexOfPhraseList, int totalPages) { var aPhraseService = new PhraseService(); string errorMessage; try { aPhraseService.SetSqlPhraseRepository(); var listOfPhrase = aPhraseService.GetListOfPhrase(dictionaryId, totalPages); foreach (var aPhrase in listOfPhrase) { var wordsId = aPhrase.WordsIds; var listOfWords = this.aWordService.GetListOfWordsForAPhrase(wordsId); aPhrase.ListOfWords = listOfWords; } if (listOfPhrase.Any()) { return(this.ControllerContext.Request.CreateResponse(HttpStatusCode.OK, listOfPhrase)); } throw new Exception("No words in dictionary"); } catch (Exception e) { errorMessage = e.Message; } return(this.ControllerContext.Request.CreateResponse( HttpStatusCode.BadRequest, errorMessage)); }
public static void AssmStart(TestContext context) { options = new DbContextOptionsBuilder <SDSComContext>() .UseInMemoryDatabase(databaseName: "SDSCom_Phrase_Tests") .Options; db = new SDSComContext(options); cache = null; pSvc = new PhraseService(db, cache); }
public HttpResponseMessage GetAllPhrasesInDictionary(int dictionaryId, int totalPages) { var aPhraseService = new PhraseService(); aPhraseService.SetSqlPhraseRepository(); var phraseList = aPhraseService.GetListOfPhrase(dictionaryId, totalPages); if (!phraseList.Any()) { return(this.ControllerContext.Request.CreateResponse( HttpStatusCode.BadRequest, "There is no phrases in dictionary")); } return(this.ControllerContext.Request.CreateResponse(HttpStatusCode.OK, phraseList)); }
public PhraseApi(PhraseService phraseService, TTSService tts) { PhraseService = phraseService; }
public Commands() { _db = new GameBotDbContext(); _phraseService = new PhraseService(_db); }
public PhraseController(IMapper mapper) { Mapper = mapper; Service = new PhraseService(mapper); }
public PhrasesController(PhraseService phraseService) { _phraseService = phraseService; smartCenter = new SmarCenter(); }