Пример #1
0
        public static int AddProductToFavorite(int productId, int userId, int storeId = 0)
        {
            FavoriteDao favoriteDao = new FavoriteDao();

            if (favoriteDao.ExistsProduct(productId, userId, storeId))
            {
                return((favoriteDao.DeleteFavorite(userId, productId, storeId) > 0) ? 1 : 0);
            }
            return((ProductBrowser.AddProduct(productId, userId, storeId) > 0) ? 2 : 0);
        }
Пример #2
0
        public static int AddProduct(int productId, int userId, int storeId = 0)
        {
            FavoriteDao favoriteDao = new FavoriteDao();

            if (favoriteDao.ExistsProduct(productId, userId, storeId))
            {
                return(1);
            }
            FavoriteInfo model = new FavoriteInfo
            {
                ProductId = productId,
                UserId    = userId,
                StoreId   = storeId,
                Tags      = ""
            };

            return((int)favoriteDao.Add(model, null));
        }
Пример #3
0
        public static bool AddProductToFavorite(int productId, int userId)
        {
            FavoriteDao dao = new FavoriteDao();

            return(dao.ExistsProduct(productId, userId) || dao.AddProductToFavorite(productId, userId));
        }
Пример #4
0
 public static bool AddProductToFavorite(int productId, int userId)
 {
     FavoriteDao dao = new FavoriteDao();
     return (dao.ExistsProduct(productId, userId) || dao.AddProductToFavorite(productId, userId));
 }
Пример #5
0
        public static bool AddProductToFavorite(int productId, int userId, string tags, string remark)
        {
            FavoriteDao favoriteDao = new FavoriteDao();

            return(favoriteDao.ExistsProduct(productId, userId) || favoriteDao.AddProductToFavorite(productId, userId, tags, remark));
        }