Ejemplo n.º 1
0
        public User Get(string id, bool includePermissions = false, long?shoppingListId = null)
        {
            User user = dbContext.Users.Find(id);

            if (includePermissions)
            {
                if (shoppingListId == null)
                {
                    throw new ArgumentNullException("shoppingListId cannot be null when includePermissions is set to true.");
                }
                dbContext.Entry(user).Collection(u => u.ShoppingListPermissions).Query().Where(p => p.ShoppingListId == shoppingListId).Load();
            }
            return(user);
        }
Ejemplo n.º 2
0
        public ShoppingList Get(long id, bool includeListItems = false, bool includeCreator = false)
        {
            ShoppingList shoppingList = _dbContext.ShoppingLists.Find(id);

            if (shoppingList != null)
            {
                if (includeListItems)
                {
                    _dbContext.Entry(shoppingList).Collection(sl => sl.ListItems).Load();
                }
                if (includeCreator)
                {
                    _dbContext.Entry(shoppingList).Reference(sl => sl.Creator).Load();
                }
            }
            return(shoppingList);
        }
Ejemplo n.º 3
0
 public virtual void Update(ListItem listItem)
 {
     _dbContext.Entry(listItem).State = EntityState.Modified;
 }