public TextModel GetWordsCountFromDB() { try { var models = _textRepository.GetAll(); var model = models.FirstOrDefault(x => x.Text.ToString().Length > 0); var textModel = TextMapper.ToTextObject(model); if (textModel != null && textModel.Id != -1) { textModel.WordsCount = TextHelper.CountWordsFromText(textModel.Text); } return(textModel); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get all documents in the collection /// </summary> /// <typeparam name="T">The POCO class represented by all documents</typeparam> /// <returns>A collection of <see cref="DocumentWrapper{T}"/> objects. <seealso cref="DocumentWrapperExtensions.Unwrap"/></returns> public IEnumerable <DocumentWrapper <T> > GetAll <T>() where T : class => textRepository .GetAll(tag) .Select(dataEnvelope => new DocumentWrapper <T>(dataEnvelope, this));
public async Task <IEnumerable <TextFile> > GetAll() { var texts = await _textRepository.GetAll(); return(_mapper.Map <IEnumerable <TextFile> >(texts)); }
public async Task <Guid[]> GetIds() { var source = await TextRepository.GetAll(); return(source.Select(i => i.Id).ToArray()); }