Esempio n. 1
0
        public int AddToCart(int fileId, UserProfileInfo user)
        {
            DownloadCartItem item = new DownloadCartItem();

            item.FileId = fileId;
            item.User   = user;
            item        = this.dbContext.DownloadCarts.Add(item);
            this.dbContext.SaveChanges();
            return(item.Id);
        }
Esempio n. 2
0
        public void DownloadCart_02_GetCart()
        {
            UserProfileInfo user = serviceUser.GetCurrentUser();

            IList <DownloadCartItem> downloadCart = serviceDownload.GetByUserId(user.Id);

            Assert.IsTrue(downloadCart.Count > 0);
            DownloadCartItem first = downloadCart[0];

            Assert.IsNotNull(first);
            Assert.IsNotNull(first.File);
            Assert.IsFalse(String.IsNullOrEmpty(first.File.PublicUrl));
        }
Esempio n. 3
0
        public bool Delete(int id, UserProfileInfo user)
        {
            if (id <= 0)
            {
                return(false);
            }
            DownloadCartItem item = this.repoDownloadCart.GetById(id);

            if (item.User.Id != user.Id)
            {
                return(false);
            }
            return(this.repoDownloadCart.Delete(item));
        }
Esempio n. 4
0
 public bool Delete(DownloadCartItem item)
 {
     this.dbContext.DownloadCarts.Remove(item);
     this.dbContext.SaveChanges();
     return(true);
 }