public ClaimedProductKey(ProductKey productKey, AppUser user, DateTime? dateAdded, string note)
        {
            ListingID = productKey.ListingID;
            Listing = productKey.Listing;

            Key = productKey.ItemKey;
            Date = dateAdded ?? DateTime.Now;
            IsGift = productKey.IsGift;
            IsUsed = false;
            IsRevealed = false;
            AcquisitionTitle = note;

            UserID = user.Id;
            AppUser = user;
        }
Beispiel #2
0
        public ClaimedProductKey(ProductKey productKey, AppUser user, DateTime?dateAdded, string note)
        {
            ListingID = productKey.ListingID;
            Listing   = productKey.Listing;

            Key              = productKey.ItemKey;
            Date             = dateAdded ?? DateTime.Now;
            IsGift           = productKey.IsGift;
            IsUsed           = false;
            IsRevealed       = false;
            AcquisitionTitle = note;

            UserID  = user.Id;
            AppUser = user;
        }
Beispiel #3
0
        /// <summary> Adds the specified product key to this listing and updates this listing's quantity. </summary>
        /// <param name="productKey"> The specified product key to add to this listing. </param>
        public void AddProductKeyAndUpdateQuantity(ProductKey productKey)
        {
            productKey.Listing = this;

            if (ProductKeys == null)
            {
                ProductKeys = new HashSet <ProductKey>();
            }

            this.ProductKeys.Add(productKey);

            Quantity++;

            //UpdateParentQuantities();
        }
Beispiel #4
0
        /// <summary> Removes the specified product key entity from this listing and update the quantity of this listing. </summary>
        /// <param name="productKey"> The specified product key entity to remove from this listing. </param>
        /// <returns> Returns the removed product key entity if it existed, otherwise returns null. </returns>
        public ProductKey RemoveProductKeyAndUpdateQuantity(ProductKey productKey)
        {
            if (productKey == null)
            {
                return(null);
            }

            if (this?.ProductKeys?.Count == 0)
            {
                return(null);
            }

            if (ProductKeys.Contains(productKey))
            {
                ProductKeys.Remove(productKey);
                Quantity--;
                //UpdateParentQuantities();

                return(productKey);
            }

            return(null);
        }
        public void UpdateProductKey(ProductKey productKey)
        {
            ProductKey targetProductKey = context.ProductKeys.Find(productKey.ProductKeyID);

            if (targetProductKey != null)
            {
                targetProductKey.ListingID = productKey.ListingID;
                targetProductKey.ItemKey = productKey.ItemKey;
                targetProductKey.IsGift = productKey.IsGift;
            }
        }
 public void InsertProductKey(ProductKey productKey)
 {
     context.ProductKeys.Add(productKey);
 }
Beispiel #7
0
        public ProductKey RemoveProductKey(ProductKey productKey)
        {
            if (ProductKeys.Contains(productKey))
            {
                ProductKeys.Remove(productKey);
                Quantity--;
                UpdateParentQuantities();

                return productKey;
            }

            return null;
        }
Beispiel #8
0
        public void AddProductKey(ProductKey productKey)
        {
            productKey.Listing = this;
            if (ProductKeys == null)
            {
                ProductKeys = new HashSet<ProductKey>();
            }
            this.ProductKeys.Add(productKey);
            Quantity++;

            UpdateParentQuantities();
        }
Beispiel #9
0
 public void EditProductKey(ProductKey productKey)
 {
     listingRepository.UpdateProductKey(productKey);
     unitOfWork.Save();
 }