public SearchResponse SearchWord(SearchWordRequest request) { try { using (DDS_Context dbContext = new DDS_Context()) { SearchResponse response = new SearchResponse(); var entity = dbContext.Dictionary.FirstOrDefault(x => x.Word == request.Word); if (entity != null) { response = new SearchResponse() { Word = entity.Word, Content = entity.Content, DeveloperId = entity.DeveloperId, InterestId = entity.InterestId, CreatedDate = Convert.ToString(entity.CreatedDate), UpdatedDate = Convert.ToString(entity.UpdatedDate) }; } else { response.IsSucceed = false; response.Message = $"{request.Word} kelimesi sözlükte bulunamadı!"; } return(response); } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> SearchDictionary(int id, string query, int pageNumber = 1, int pageSize = 10) { var request = new SearchWordRequest { DictionaryId = id, Query = query, PageNumber = pageNumber, PageSize = pageSize }; await _commandProcessor.SendAsync(request); return(Ok(request.Result)); }
public ActionResult Search(SearchWordRequest request) { SearchResponse response = new SearchResponse(); response = word_Service.SearchWord(request); if (response.IsSucceed) { return(View(response)); } else { NotFoundResponse result = new NotFoundResponse(); InterestService interest_Service = new InterestService(); result.Interests = interest_Service.GetAllInterests(); result.Word = request.Word; return(PartialView("_NotFoundPage", result)); } }
public async Task <SearchWordResponse> SearchWord([FromUri] SearchWordRequest request) { return(await Invoke(request, Repository.SearchWord)); }