Exemplo n.º 1
0
        /// <summary>
        /// Update the real product's stock with the quantity selected from the user's purchased product
        /// </summary>
        /// <param name="purchProduct">The product the user purchased</param>
        public void UpdateStock(PurchasedProduct purchProduct)
        {
            bool FoundUniqueCheckoutPropKey = false;

            if (purchProduct.SelectedCheckoutProperties != null && purchProduct.SelectedCheckoutProperties.Count > 0)
            {
                if (CheckoutPropertySettingsList != null && CheckoutPropertySettingsList.Count > 0)
                {
                    foreach (var CheckoutPropSetting in CheckoutPropertySettingsList)
                    {
                        if (purchProduct.GetUniqueCheckoutPropertyKey().Equals(CheckoutPropSetting.GetUniqueCheckoutPropertyKey()))
                        {
                            CheckoutPropSetting.PurchaseSettings.StockLevel -= purchProduct.Quantity;
                            FoundUniqueCheckoutPropKey = true;
                            break;
                        }
                    }
                }
            }

            if (!FoundUniqueCheckoutPropKey)
            {
                PurchaseSettings.StockLevel -= purchProduct.Quantity;
            }
        }
Exemplo n.º 2
0
        public void AddToPurchaseCart(PurchaseModelView purchaseModelView)
        {
            PurchasedProduct purchasedProduct = Mapper.Map <PurchasedProduct>(purchaseModelView);


            purchaseModelView.PurchasedProducts.Add(purchasedProduct);
        }
Exemplo n.º 3
0
    public string UpdatePurchasedProduct(int id, PurchasedProduct purchasedProduct)
    {
        try
        {
            YWC_StorageEntities db = new YWC_StorageEntities();

            //Fetch an object from db
            PurchasedProduct p = db.PurchasedProducts.Find(id);

            //Replace the data in db
            p.Name          = purchasedProduct.Name;
            p.Price         = purchasedProduct.Price;
            p.TypeId        = purchasedProduct.TypeId;
            p.Description   = purchasedProduct.Description;
            p.Image         = purchasedProduct.Image;
            p.Stock         = purchasedProduct.Stock;
            p.DatePurchased = purchasedProduct.DatePurchased;
            p.ClientID      = purchasedProduct.ClientID;
            p.Amount        = purchasedProduct.Amount;

            db.SaveChanges();

            return(purchasedProduct.Name + " was successfully updated");
        }
        catch (Exception e)
        {
            return("Error:" + e);
        }
    }
Exemplo n.º 4
0
 public void Remove(PurchasedProduct purchasedProduct)
 {
     using (var dbContext = new SportStoreDbContext())
     {
         dbContext.PurchasedProductDbSet.Remove(purchasedProduct);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void Update(PurchasedProduct purchasedProduct)
 {
     using (var dbContext = new SportStoreDbContext())
     {
         var purchasedProductInRepository = GetById(purchasedProduct.Id);
         dbContext.Entry(purchasedProductInRepository).CurrentValues.SetValues(purchasedProduct);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 6
0
        public bool Update(PurchasedProduct purchasedProduct)
        {
            PurchasedProduct cuPurchasedProduct =
                _projectDbContext.PurchasedProducts.FirstOrDefault(c => c.Id == purchasedProduct.Id);

            //if(cuPurchasedProduct!=null) cuPurchasedProduct = Mapper.Map<PurchasedProduct>(purchasedProduct);


            return(_projectDbContext.SaveChanges() > 0);
        }
 public static ProductHistoryDTO FromPurchasedProduct(PurchasedProduct purchasedProduct)
 {
     return(new ProductHistoryDTO
     {
         Id = purchasedProduct.id,
         Name = purchasedProduct.name,
         Quantity = purchasedProduct.quantity,
         Price = purchasedProduct.price,
     });
 }
Exemplo n.º 8
0
        public bool Delete(int id)
        {
            PurchasedProduct purchasedProduct = _projectDbContext.PurchasedProducts.FirstOrDefault(c => c.Id == id);

            if (purchasedProduct != null)
            {
                _projectDbContext.PurchasedProducts.Remove(purchasedProduct);
            }

            return(_projectDbContext.SaveChanges() > 0);
        }
Exemplo n.º 9
0
        public double CalculateTotalTest_ABCD(string input)
        {
            var objProduct = new PurchasedProduct();

            objProduct = terminal1.ScanProductsByBarcode(input);
            DataTable dt = new DataTable();

            dt = terminal2.SetPricing(objProduct.Name);
            double sum = 0;

            sum = terminal.CalculateTotal(dt);
            return(sum);
        }
Exemplo n.º 10
0
 public void UpdateStock(int id, int x)
 {
     try
     {
         using (YWC_StorageEntities db = new YWC_StorageEntities())
         {
             PurchasedProduct purchasedProduct = db.PurchasedProducts.Find(id);
             purchasedProduct.Stock = x;
             db.SaveChanges();
         }
     }
     catch (Exception) { }
 }
Exemplo n.º 11
0
 public float CalculateSubTotal(PurchasedProduct item)
 {
     if (item.OfferId == 1)
     {
         var subTotal = item.Quantity * item.UnitPrice;
         return(subTotal);
     }
     else
     {
         var number   = item.Quantity % item.OfferVolume;
         var subTotal = ((item.Quantity / item.OfferVolume) * item.OfferPrice) + (number * item.UnitPrice);
         return(subTotal);
     }
 }
Exemplo n.º 12
0
    public string InsertPurchasedProduct(PurchasedProduct purchasedProduct)
    {
        try
        {
            YWC_StorageEntities db = new YWC_StorageEntities();
            db.PurchasedProducts.Add(purchasedProduct);
            db.SaveChanges();

            return(purchasedProduct.Name + " was successfully inserted");
        }
        catch (Exception e)
        {
            return("Error:" + e);
        }
    }
Exemplo n.º 13
0
        public void addCartToPurProd(string custId, string prodId)
        {
            Product          product = dbcontext.Products.Where(x => x.Id == prodId).FirstOrDefault();
            PurchasedProduct pp      = new PurchasedProduct();

            pp.Id             = Guid.NewGuid().ToString();
            pp.ProductName    = product.ProductName;
            pp.ActivationCode = Guid.NewGuid().ToString();
            pp.CustomerId     = custId;
            pp.Image          = product.Image;
            pp.Description    = product.ProductDescription;
            pp.PurchaseDate   = DateTime.Now;
            dbcontext.Add(pp);
            dbcontext.SaveChanges();
        }
Exemplo n.º 14
0
 public PurchasedProduct GetPurchasedProduct(int id)
 {
     try
     {
         using (YWC_StorageEntities db = new YWC_StorageEntities())
         {
             PurchasedProduct purchasedProduct = db.PurchasedProducts.Find(id);
             return(purchasedProduct);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 15
0
    public string DeletePurchasedProduct(int id)
    {
        try
        {
            YWC_StorageEntities db = new YWC_StorageEntities();
            PurchasedProduct    purchasedProduct = db.PurchasedProducts.Find(id);

            db.PurchasedProducts.Attach(purchasedProduct);
            db.PurchasedProducts.Remove(purchasedProduct);
            db.SaveChanges();

            return(purchasedProduct.Name + " was successfully deleted");
        }
        catch (Exception e)
        {
            return("Error:" + e);
        }
    }
Exemplo n.º 16
0
        public ActionResult AddToPurchaseCart(PurchaseModelView purchaseModelView)
        {
            purchaseModelView.ProductSelectListItems = _productManager.GetAll()
                                                       .Where(c => c.CategoryId == purchaseModelView.CategoryId).Select(c => new SelectListItem()
            {
                Value = c.Id.ToString(),
                Text  = c.Name
            }).ToList();

            PurchasedProduct purchasedProduct = Mapper.Map <PurchasedProduct>(purchaseModelView);


            purchaseModelView.PurchasedProducts.Add(purchasedProduct);



            return(PartialView("Purchase/_InCartProducts", purchaseModelView));
        }
Exemplo n.º 17
0
        public bool Update(PurchasedProduct purchasedProduct)
        {
            PurchasedProduct apurchasedProduct = _projectDbContext.PurchasedProducts.FirstOrDefault(c => c.Id == purchasedProduct.Id);

            if (apurchasedProduct != null)
            {
                apurchasedProduct.Id              = purchasedProduct.Id;
                apurchasedProduct.PurchaseId      = purchasedProduct.PurchaseId;
                apurchasedProduct.ProductId       = purchasedProduct.ProductId;
                apurchasedProduct.ManufactureDate = purchasedProduct.ManufactureDate;
                apurchasedProduct.ExpireDate      = purchasedProduct.ExpireDate;
                apurchasedProduct.Mrp             = purchasedProduct.Mrp;
                apurchasedProduct.Remarks         = purchasedProduct.Remarks;
                apurchasedProduct.UnitPrice       = purchasedProduct.UnitPrice;
                apurchasedProduct.Quantity        = purchasedProduct.Quantity;
            }
            return(_projectDbContext.SaveChanges() > 0);
        }
Exemplo n.º 18
0
        public async Task GetAll()
        {
            //Arrange

            var firstUser = new User()
            {
                Id = "first-user-id", UserName = "******"
            };
            var secondUser = new User()
            {
                Id = "second-user-id", UserName = "******"
            };
            var firstPurchase = new Purchase()
            {
                Id = "first-purchase-id", DateOfOrder = DateTime.MinValue, UserId = "first-user-id"
            };
            var secondPurchase = new Purchase()
            {
                DateOfOrder = DateTime.MaxValue, UserId = "second-user-id"
            };
            var product = new PurchasedProduct()
            {
                Id = "purchased-product-id", PurchaseId = "first-purchase-id"
            };

            await this.context.AddRangeAsync(firstUser, secondUser, firstPurchase, secondPurchase, product);

            await this.context.SaveChangesAsync();

            var mapperConfig = new MapperConfiguration(x => x.AddProfile(new MappingProfile()));
            var mapper       = mapperConfig.CreateMapper();

            var purchaseService = new PurchaseService(this.context, mapper);

            //Act

            var purchases = await purchaseService.GetAll <PurchaseViewModel>();

            //Assert

            Assert.Equal("SecondUsername", purchases[0].Username);
            Assert.Equal("FirstUsername", purchases[1].Username);
            Assert.NotNull(purchases[1].Products[0]);
        }
    public void DoListProducts()
    {
        var inApp = FindObjectOfType <CotcInappPurchaseGameObject>();

        if (!RequireGamer())
        {
            return;
        }

        var pp     = new PurchasedProduct[1];
        var result = new ValidateReceiptResult[1];

        Gamer.Store.ListConfiguredProducts()
        .Then(products => {
            Debug.Log("Got BO products.");
            return(inApp.FetchProductInfo(products));
        })
        .Then(enrichedProducts => {
            Debug.Log("Received enriched products");
            foreach (ProductInfo pi in enrichedProducts)
            {
                Debug.Log(pi.ToJson());
            }

            // Purchase the first one
            return(inApp.LaunchPurchase(Gamer, enrichedProducts[0]));
        })
        .Then(purchasedProduct => {
            Debug.Log("Purchase ok: " + purchasedProduct.ToString());
            pp[0] = purchasedProduct;
            return(Gamer.Store.ValidateReceipt(purchasedProduct.StoreType, purchasedProduct.CotcProductId, purchasedProduct.PaidPrice, purchasedProduct.PaidCurrency, purchasedProduct.Receipt));
        })
        .Then(validationResult => {
            Debug.Log("Validated receipt");
            result[0] = validationResult;
            return(inApp.CloseTransaction(pp[0]));
        })
        .Then(done => {
            Debug.Log("Purchase transaction completed successfully: " + result[0].ToString());
        })
        .Catch(ex => {
            Debug.LogError("Error during purchase: " + ex.ToString());
        });
    }
        public bool Update(PurchasedProduct purchasedProduct)
        {
            PurchasedProduct cuPurchasedProduct =
                _projectDbContext.PurchasedProducts.FirstOrDefault(c => c.ProductId == purchasedProduct.ProductId);

            //if(cuPurchasedProduct!=null) cuPurchasedProduct = Mapper.Map<PurchasedProduct>(purchasedProduct);
            if (cuPurchasedProduct != null)
            {
                cuPurchasedProduct.PurchaseId      = cuPurchasedProduct.PurchaseId;
                cuPurchasedProduct.Quantity        = purchasedProduct.Quantity;
                cuPurchasedProduct.ProductId       = cuPurchasedProduct.ProductId;
                cuPurchasedProduct.Mrp             = cuPurchasedProduct.Mrp;
                cuPurchasedProduct.ManufactureDate = cuPurchasedProduct.ManufactureDate;
                cuPurchasedProduct.ExpireDate      = cuPurchasedProduct.ExpireDate;
                cuPurchasedProduct.UnitPrice       = cuPurchasedProduct.UnitPrice;
                cuPurchasedProduct.Remarks         = cuPurchasedProduct.Remarks;
            }

            return(_projectDbContext.SaveChanges() > 0);
        }
Exemplo n.º 21
0
        private void txtScan_TextChanged(object sender, EventArgs e)
        {
            string barcode    = txtScan.Text;
            var    objProduct = new PurchasedProduct();

            objProduct = terminal1.ScanProductsByBarcode(barcode);
            if (objProduct.Name != null)
            {
                txtProductName.Text      = objProduct.Name;
                txtUnitPrice.Text        = objProduct.UnitPrice.ToString();
                txtOfferDescription.Text = objProduct.OfferDescription;
                lblError.Visible         = false;
            }
            else
            {
                lblError.Text    = "Please scan again";
                lblError.Visible = true;
                txtScan.Text     = string.Empty;
            }
        }
Exemplo n.º 22
0
        public async Task GetUserPurchaseHistory()
        {
            //Arrange

            var user = new User()
            {
                Id = "user-id", UserName = "******"
            };
            var firstPurchase = new Purchase()
            {
                Id = "first-purchase-id", UserId = "user-id"
            };
            var secondPurchase = new Purchase()
            {
                DateOfOrder = DateTime.MaxValue
            };
            var product = new PurchasedProduct()
            {
                Id = "purchased-product-id", PurchaseId = "first-purchase-id"
            };

            await this.context.AddRangeAsync(user, firstPurchase, secondPurchase, product);

            await this.context.SaveChangesAsync();

            var mapperConfig = new MapperConfiguration(x => x.AddProfile(new MappingProfile()));
            var mapper       = mapperConfig.CreateMapper();


            var purchaseService = new PurchaseService(this.context, mapper);

            //Act

            var purchases = await purchaseService
                            .GetUserPurchaseHistory <PurchaseHistoryModel.PurchaseViewModel>("Username");

            //Assert

            Assert.Single(purchases);
            Assert.NotNull(purchases[0].Products[0]);
        }
Exemplo n.º 23
0
        public PurchasedProduct ScanProducts(string _barCode)
        {
            var    objProduct = new PurchasedProduct();
            string CS         = ConfigurationManager.ConnectionStrings["POS.Properties.Settings.Setting"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(CS))
            {
                SqlCommand command = new SqlCommand("spGetProductDetails", connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                SqlParameter barCode = new SqlParameter("@ProductName", _barCode);
                command.Parameters.Add(barCode);
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        objProduct.Name             = (string)reader["ProductName"];
                        objProduct.Barcode          = (string)reader["ProductName"];
                        objProduct.UnitPrice        = (float)Convert.ChangeType(reader["UnitPrice"], typeof(float));
                        objProduct.OfferDescription = (string)reader["OfferDescription"];
                        objProduct.OfferPrice       = (float)Convert.ChangeType(reader["OfferPrice"], typeof(float));
                        objProduct.OfferVolume      = (int)reader["OfferVolume"];
                        objProduct.OfferId          = (int)reader["OfferId"];
                    }
                    connection.Close();
                    return(objProduct);
                }
                catch (Exception ex)
                {
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Exemplo n.º 24
0
 public bool  Add(PurchasedProduct purchasedProduct)
 {
     return(_purchaseProductRepository.Add(purchasedProduct));
 }
Exemplo n.º 25
0
        public DataTable SetPricingProduct(string _barCode)
        {
            var    objProduct = new PurchasedProduct();
            string CS         = ConfigurationManager.ConnectionStrings["POS.Properties.Settings.Setting"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(CS))
            {
                SqlCommand command = new SqlCommand("spGetProductDetails", connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                SqlParameter barCode = new SqlParameter("@ProductName", _barCode);
                command.Parameters.Add(barCode);
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        objProduct.Name             = (string)reader["ProductName"];
                        objProduct.Barcode          = (string)reader["ProductName"];
                        objProduct.UnitPrice        = (float)Convert.ChangeType(reader["UnitPrice"], typeof(float));
                        objProduct.OfferDescription = (string)reader["OfferDescription"];
                        objProduct.OfferPrice       = (float)Convert.ChangeType(reader["OfferPrice"], typeof(float));
                        objProduct.OfferVolume      = (int)reader["OfferVolume"];
                        objProduct.OfferId          = (int)reader["OfferId"];
                    }
                    connection.Close();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
            var objProductExist = new PurchasedProduct();

            if (items.Exists(x => x.Name.Contains(objProduct.Name)))
            {
                objProductExist          = items.Find(x => x.Name.Contains(objProduct.Name));
                objProductExist.Quantity = objProductExist.Quantity + 1;
            }
            else
            {
                objProduct.Quantity = 1;
                items.Add(objProduct);
            }

            #region DataTable
            DataTable  dt = new DataTable();
            DataRow    row;
            DataColumn column1 = new DataColumn();
            column1.ColumnName        = "No";
            column1.AutoIncrement     = true;
            column1.AutoIncrementSeed = 1;
            dt.Columns.Add(column1);
            DataColumn column2 = new DataColumn();
            column2.ColumnName = "Product Name";
            dt.Columns.Add(column2);
            DataColumn column3 = new DataColumn();
            column3.ColumnName = "Unit Price";
            dt.Columns.Add(column3);
            DataColumn column4 = new DataColumn();
            column4.ColumnName = "Offer Description";
            dt.Columns.Add(column4);
            DataColumn column5 = new DataColumn();
            column5.ColumnName = "Quantity";
            dt.Columns.Add(column5);
            DataColumn column6 = new DataColumn();
            column6.ColumnName = "ItemTotal in $";
            dt.Columns.Add(column6);
            foreach (var item in items)
            {
                row = dt.NewRow();
                row["Product Name"]      = item.Name;
                row["Unit Price"]        = item.UnitPrice;
                row["Offer Description"] = item.OfferDescription;
                row["Quantity"]          = item.Quantity;
                row["ItemTotal in $"]    = CalculateSubTotal(item);
                dt.Rows.Add(row);
            }
            #endregion
            return(dt);
        }
Exemplo n.º 26
0
        // Clicked CheckOut Link
        // Buy Product
        public ActionResult BuyProduct()
        {
            List <string>           purchase_lis          = (List <string>)Session["clicked_history"];
            List <PurchasedProduct> purchased_product_lis = new List <PurchasedProduct>();
            string format       = "dd MMMM yyyy";
            string current_date = DateTime.Today.ToString(format);

            if (purchase_lis.Count != 0)
            {
                foreach (string pro_id in purchase_lis)
                {
                    using (SqlConnection sql_connection = new SqlConnection(sql_con))
                    {
                        sql_connection.Open();

                        string target_sql_data = "select * from Product where Id=" + pro_id + ";";

                        SqlCommand sql_cmd = new SqlCommand(target_sql_data, sql_connection);

                        SqlDataReader reader = sql_cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            Product pro = new Product()
                            {
                                Id                = (int)reader["Id"],
                                name              = (string)reader["name"],
                                price             = (string)reader["price"],
                                quantity          = (string)reader["quantity"],
                                color             = (string)reader["color"],
                                short_description = (string)reader["short_description"],
                                image_path        = (string)reader["image_path"],
                                category          = (string)reader["category"],
                            };

                            Debug.WriteLine(current_date);

                            PurchasedProduct temp_data = new PurchasedProduct()
                            {
                                ProductImagePath      = pro.image_path,
                                ProductId             = pro.Id.ToString(),
                                ProductName           = pro.name,
                                ProductDetails        = pro.short_description,
                                ProductActivationCode = Guid.NewGuid().ToString(),
                                ProductPurchasedDate  = current_date
                            };

                            purchased_product_lis.Add(temp_data);
                        }
                        sql_connection.Close();
                    }
                }
                Add_to_ProductTable(purchased_product_lis);

                return(RedirectToAction("PurchaseHistory"));
            }
            else
            {
                return(Content("<h3>Empty List to Write</h3>"));
            }
        }
Exemplo n.º 27
0
        // Read PurchaseHistory
        public ActionResult PurchaseHistory()
        {
            string customer_email = (string)Session["Customer_email"];

            //  Read from Purchased Table
            if (Session["Customer_email"] != null)
            {
                List <PurchasedProduct> purchased_products_lis = new List <PurchasedProduct>();
                List <ID_Quantity>      id_quantity_lis        = new List <ID_Quantity>();


                using (SqlConnection sql_connection = new SqlConnection(sql_con))
                {
                    sql_connection.Open();

                    string target_sql_data = "select * from PurchasedProduct where CustomerId='" + customer_email + "';";

                    SqlCommand sql_cmd = new SqlCommand(target_sql_data, sql_connection);

                    SqlDataReader reader = sql_cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        PurchasedProduct one_purchase_pro = new PurchasedProduct()
                        {
                            Id                    = (int)reader["Id"],
                            ProductId             = (string)reader["ProductId"],
                            ProductName           = (string)reader["ProductName"],
                            ProductDetails        = (string)reader["ProductDetails"],
                            ProductImagePath      = (string)reader["ProductImagePath"],
                            ProductPurchasedDate  = (string)reader["ProductPurchasedDate"],
                            ProductActivationCode = (string)reader["ProductActivationCode"],
                            CustomerId            = customer_email
                        };

                        purchased_products_lis.Add(one_purchase_pro);
                    }
                    sql_connection.Close();
                }

                var groupedResult = purchased_products_lis.GroupBy(s => s.ProductId);

                bool flager = true;

                foreach (var ageGroup in groupedResult)
                {
                    List <string> activation_code_lis = new List <string>();

                    ID_Quantity temp_id_quantity = new ID_Quantity();
                    temp_id_quantity.ProductId       = ageGroup.Key;
                    temp_id_quantity.ProductQuantity = ageGroup.Count().ToString();

                    foreach (PurchasedProduct s in ageGroup)  //Each group has a inner collection
                    {
                        if (flager)
                        {
                            temp_id_quantity.ProductName          = s.ProductName;
                            temp_id_quantity.ProductDetails       = s.ProductDetails;
                            temp_id_quantity.ProductImagePath     = s.ProductImagePath;
                            temp_id_quantity.ProductPurchasedDate = s.ProductPurchasedDate;
                            flager = false;
                        }
                        activation_code_lis.Add(s.ProductActivationCode);
                    }
                    temp_id_quantity.ProductActivationCode = activation_code_lis;

                    flager = true;
                    id_quantity_lis.Add(temp_id_quantity);
                    activation_code_lis = null;
                }
                ViewBag.Purchased_View          = "Yes";
                ViewBag.Purchased_Products_List = id_quantity_lis;
            }
            else
            {
                return(RedirectToAction("SearchProduct"));
            }
            return(View());
        }
 public bool Update(PurchasedProduct purchasedProduct)
 {
     return(_purchasedProductRepository.Update(purchasedProduct));
 }
Exemplo n.º 29
0
        public int SelectItemToPurchase()
        {
            var selectedProduct = ReadNumericData();

            PurchasedProduct = _inventory.AllInventories.Keys.FirstOrDefault(p => p.ProductId == selectedProduct);
            while (PurchasedProduct == null)
            {
                Console.WriteLine("ERROR: No such product Exists.. please select again...");
                Console.WriteLine();
                DisplayInventory();
                selectedProduct  = ReadNumericData();
                PurchasedProduct = _inventory.AllInventories.Keys.FirstOrDefault(p => p.ProductId == selectedProduct);
            }
            Console.WriteLine(string.Format("DEBUG: Product selected for purchase: {0}", PurchasedProduct.ToString()));
            return(selectedProduct);
        }
Exemplo n.º 30
0
 public bool Add(PurchasedProduct purchasedProduct)
 {
     _projectDbContext.PurchasedProducts.Add(purchasedProduct);
     return(_projectDbContext.SaveChanges() > 0);
 }