public async Task SentenceFavoriteAsync(Domain.Entities.Sentence sentence) { var entity = sentenceRepository.FirstOrDefault(x => x.FamousSaying == sentence.FamousSaying); if (entity == null) { await sentenceRepository.AddAsync(sentence); return; } await sentenceRepository.RemoveAsync(entity); }
public async Task <bool> LoadAsync(string text) { await _sentenceCreator.CreateAsync(text); var sentences = await _sentenceCreator.GetAsync(); await _sentenceRepository.ClearAsync(); sentences.ToList() .ForEach(x => _sentenceRepository .AddAsync(x)); return(await _sentenceRepository.AnyAsync()); }