Beispiel #1
0
 public async Task <List <IFavourite> > GetAsync(string recipeId, FavouriteFilter filter = null)
 {
     try
     {
         return(await Repository.GetAsync(recipeId, filter));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #2
0
        public virtual async Task <List <IFavourite> > GetAsync(string recipeId, FavouriteFilter filter = null)
        {
            try
            {
                if (filter == null)
                {
                    filter = new FavouriteFilter(1, 5);
                }


                return(Mapper.Map <List <IFavourite> >(
                           await Repository.WhereAsync <Favourite>()
                           .Where(item => item.RecipeId == recipeId)
                           .Skip((filter.PageNumber * filter.PageSize) - filter.PageSize)
                           .Take(filter.PageSize)
                           .ToListAsync()
                           ));
            }
            catch (Exception e)
            {
                throw e;
            }
        }