public Product(Product product)
 {
     this.Title = product.Title;
     this.Price = product.Price;
     this.Description = product.Description;
     this.VideoUrl = product.VideoUrl;
     this.PayPalButton = new PayPalButton(product);
 }
 public ActionResult AddToCart(Product product)
 {
     var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
     ApplicationUser user = userManager.FindByNameAsync(User.Identity.Name).Result;
     List<Product> products = new List<Product>();
     user.UserCart.Products.Add(product);
     foreach (var item in user.UserCart.Products)
     {
         products.Add(item);
     }
     return View(products);
 }
        public ActionResult CreateProduct(Product product)
        {
            var db = new ImperiaonlineToolsDb.DAL.ImperiaonlineToolsContext();
            Product newProduct = new Product();
            {
                newProduct.Title = product.Title;
                newProduct.Price = product.Price;
                newProduct.Description = product.Description;
                newProduct.VideoUrl = product.VideoUrl;
                newProduct.PayPalButton = new PayPalButton(product);
            }

            if (ModelState.IsValid)
            {

                db.Products.Add(newProduct);
                db.SaveChanges();
                return PartialView("_CreateProductOk");
            }
            else
            {
                return PartialView("_CreateProductError");
            }
        }
 public PayPalButton(Product prod)
 {
     //this.Action = prod.PayPalButton.Action;
     this.Value = prod.PayPalButton.Value;
     //this.Image = prod.PayPalButton.Image;
 }