Exemplo n.º 1
0
        public async Task <Recipe> GetAsync(UsersRecipe entity)
        {
            var userRecipesContext = _context.UsersRecipes
                                     .Where(ur => ur.UserId == entity.UserId);

            return(await _context.Recipes
                   .Include(r => r.Ingredients)
                   .ThenInclude(i => i.Measurement)
                   .Include(r => r.Ingredients)
                   .ThenInclude(i => i.Ingredient)
                   .Include(r => r.RecipeSteps)
                   .Join(userRecipesContext,
                         r => r.Id,
                         ur => ur.RecipeId,
                         (r, ur) => r)
                   .Where(r => r.Id == entity.RecipeId)
                   .FirstOrDefaultAsync());
        }
Exemplo n.º 2
0
 public void RemoveAsync(UsersRecipe entity)
 {
     _context.UsersRecipes.Remove(entity);
 }
Exemplo n.º 3
0
 public async Task AddAsync(UsersRecipe entity)
 {
     await _context.UsersRecipes.AddAsync(entity);
 }
Exemplo n.º 4
0
 public void RemoveAsync(UsersRecipe entity)
 {
     _dal.RemoveAsync(entity);
 }
Exemplo n.º 5
0
 public async Task <Recipe> GetAsync(UsersRecipe entity)
 {
     return(await _dal.GetAsync(entity));
 }
Exemplo n.º 6
0
 public async Task AddAsync(UsersRecipe entity)
 {
     await _dal.AddAsync(entity);
 }