public async Task <List <Referat> > GetAllReferats() { using (var repository = new ReferatsRepository()) { var referats = await repository.GetAllReferats(); return(referats); } }
public async Task <List <Category> > GetAllCategories() { using (var repository = new ReferatsRepository()) { var categories = await repository.GetAllCategories(); return(categories); } }
/// <summary> /// Check if downloaded referat is not already in DB and add it to DB /// </summary> /// <param name="referat">Downloaded referat</param> /// <returns></returns> public async Task AddReferatAsync(Referat referat) { using (var repository = new ReferatsRepository()) { // Check if we have already download such a referat (COMPARE BY TOPIC) var referats = await repository.GetAllReferats(); if (referats.Any(r => r.Topic.Equals(referat.Topic, StringComparison.CurrentCultureIgnoreCase))) { return; } await repository.Insert(referat); } }