public ActionResult Create(Product product, HttpPostedFileBase upload)
 {
     if (upload != null && upload.ContentLength > 0)
     {
         var photo = new File
         {
             FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(upload.FileName),
             FileType = FileType.Photo
         };
         product.Files = new List<File>();
         product.Files.Add(photo);
         CreatePath();
         var path = string.Format("{0}\\{1}", Path, photo.FileName);
         upload.SaveAs(path);
     }
     _productService.Add(product);
     _uow.SaveChanges();
     ViewBag.ProductCategoryID = new SelectList(_productCategoryService.GetAllProductCategorys(), "ProductCategoryID", "name");
     return View();
 }
 public void Update(Product product)
 {
     _product.AddOrUpdate(product);
 }
        public Product Add(Product product)
        {
            _product.Add(product);

            return product;
        }