public async Task <IEnumerable <DishLight> > GetAllDishes(int limit, int offset) { var dishResults = await m_queryExecutor.HandleAsync(new DishLightQuery { Limit = limit, Offset = offset }); var dishes = new List <DishLight>(); foreach (var dishResult in dishResults) { //TODO: Finn bedre løsning på sql spørring IEnumerable <TagResult> tags = await m_dishTagService.FindTagsForDish(dishResult.Id); dishes.Add(new DishLight { Id = dishResult.Id, Name = dishResult.Name, Description = dishResult.Description, Difficulty = dishResult.Difficulty, Duration = dishResult.Duration, Author = dishResult.Author, TimeAdded = dishResult.TimeAdded, Tags = tags }); } return(dishes); }
public async Task <IEnumerable <DishLight> > Search(string parameter, int limit, int offset) { var dishes = new List <DishLight>(); IEnumerable <DishLightResult> dishLightResult = await m_queryExecutor.HandleAsync( new SearchQuery { Parameter = "%" + parameter + "%", Limit = limit, Offset = offset } ); foreach (var dishResult in dishLightResult) { IEnumerable <TagResult> tags = await m_dishTagService.FindTagsForDish(dishResult.Id); dishes.Add(new DishLight { Id = dishResult.Id, Name = dishResult.Name, Description = dishResult.Description, Difficulty = dishResult.Difficulty, Duration = dishResult.Duration, Author = dishResult.Author, TimeAdded = dishResult.TimeAdded, Tags = tags }); } return(dishes); }
public async Task <IEnumerable <TagResult> > Get(int dishId) { var result = await m_dishTagService.FindTagsForDish(dishId); return(result); }