public JsonResult Upload(FormCollection forms)
        {
            try
            {
                string ProductCode = forms.Get("ProductCode");
                var file = Request.Files["Filedata"];
                string savePath = Server.MapPath(@"~\Content\ProductImages\" + file.FileName);
                file.SaveAs(savePath);
                ProductsImagesModel model = new ProductsImagesModel();
                model.ImageURL = model.smallImageURL = file.FileName;
                model.IsMainImage = false;
                model.ProductCode = ProductCode;
                model.Name = file.FileName.Substring(0, file.FileName.LastIndexOf('.')); ;
                unitOfWork.ProductsImagesRepository.Insert(model);
                unitOfWork.Save();
                model.ImageURL = Url.Content(@"~\Content\ProductImages\" + file.FileName);
                return Json(model, JsonRequestBehavior.AllowGet);

            }
            //catch (DbEntityValidationException dbEx)
            //{
            //    foreach (var validationErrors in dbEx.EntityValidationErrors)
            //    {
            //        foreach (var validationError in validationErrors.ValidationErrors)
            //        {
            //            Trace.TraceInformation("Property: {0} Error: {1}",
            //                                    validationError.PropertyName,
            //                                    validationError.ErrorMessage);
            //        }
            //    }
            //    return null;
            //}
            catch (Exception ex)
            {

                return Json(ex.Message, JsonRequestBehavior.AllowGet);
            }
        }
 public void UpdateVideo(ProductsImagesModel model)
 {
     if (ModelState.IsValid)
     {
         var _data = unitOfWork.ProductsVideosRepository.GetByID(model.ID);
         //_data.IsActive = model.IsActive;
         _data.Name = model.Name;
         unitOfWork.ProductsVideosRepository.Update(_data);
         unitOfWork.Save();
     }
 }