public bool Add(User ownerID, string title, string shortDescription, string longDescription, double price, List <Byte[]> images)
        {
            if (ProductValidation.Validation(ownerID, title, shortDescription, longDescription, price))
            {
                using (StoreContext stContext = new StoreContext())
                {
                    var userInDB = (from u in stContext.UserList select u).FirstOrDefault(us => us.ID == ownerID.ID);
                    if (userInDB == null)
                    {
                        return(false);
                    }



                    Product prod = new Product()
                    {
                        OwnerID          = userInDB,
                        Title            = title,
                        ShortDescription = shortDescription,
                        LongDescription  = longDescription,
                        Price            = price,
                        Date             = DateTime.Now,
                        state            = ClassLibrary.State.Available,
                        CartTime         = DateTime.Now.AddYears(1)
                    };
                    if (images.Count > 0)
                    {
                        prod.Picture1 = images[0];
                        if (images.Count > 1)
                        {
                            prod.Picture2 = images[1];
                            if (images.Count > 2)
                            {
                                prod.Picture3 = images[2];
                            }
                        }
                    }



                    stContext.ProductList.Add(prod);
                    stContext.SaveChanges();
                    //var tmp = (from a in stContext.ProductList select a).FirstOrDefault(a => a == prod);
                    //AddImageToProduct(tmp.ID, images);
                }

                return(true);
            }
            return(false);
        }
 public bool Add(User ownerID, string title, string shortDescription, string longDescription, double price)
 {
     if (ProductValidation.Validation(ownerID, title, shortDescription, longDescription, price))
     {
         using (StoreContext stContext = new StoreContext())
         {
             stContext.ProductList.Add(new Product()
             {
                 OwnerID          = ownerID,
                 Title            = title,
                 ShortDescription = shortDescription,
                 LongDescription  = longDescription,
                 Price            = price,
                 Date             = DateTime.Now,
                 state            = ClassLibrary.State.Available
             });
             stContext.SaveChanges();
         }
         return(true);
     }
     return(false);
 }