public async Task <ActionResult> Create(Product collection, HttpPostedFileBase pFile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here
                    ProductBL wDB        = new ProductBL();
                    var       appSetting = ConfigurationManager.AppSettings;
                    string    pathImage  = appSetting["PathImage"];
                    collection.Image = pathImage + collection.ImageFile.FileName;
                    collection.ImageFile.SaveAs(collection.Image);
                    await wDB.InsertProduct(ProductEntityToProductModel.ConvertoProdyctEntityTOProductModel(collection), "");

                    return(RedirectToAction("Home"));
                }
                else
                {
                    collection.Brands      = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("marca"));
                    collection.Colors      = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Colori"));
                    collection.Categories  = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Categorie"));
                    collection.Headmoneies = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Taglie"));
                    collection.Models      = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Modelli"));

                    return(View(collection));
                }
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        // GET: Product/Create
        public async Task <ActionResult> Create()
        {
            Product wProd = new Product();

            wProd.Brands      = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("marca"));
            wProd.Colors      = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Colori"));
            wProd.Categories  = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Categorie"));
            wProd.Headmoneies = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Taglie"));
            wProd.Models      = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Modelli"));
            return(View(wProd));
        }
 private async Task <FilterStatistics> Init(string pNameStatistic)
 {
     try
     {
         FilterStatistics wFilter = new FilterStatistics();
         wFilter.NameStatistic = pNameStatistic;
         wFilter.Categories    = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Categorie"));
         return(wFilter);
     }
     catch (Exception ex)
     {
         Log.Error("Inizializazione Filtri Statistici", ex);
     }
     return(null);
 }
 public async Task <ActionResult> Index(AbbigliamentoECommerce.Models.SearchProduct pProd)
 {
     try
     {
         ViewBag.ListProducts = TempData["ListProducts"];
         pProd.Brands         = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("marca"));
         pProd.Colors         = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Colori"));
         pProd.Categories     = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Categorie"));
         pProd.Headmoneies    = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Taglie"));
         pProd.Models         = CategoryEntityTOCategoryModel.ConvertoListCategoryEntityTOListCategoryModel(await new CategoryBL().GetCategory("Modelli"));
         return(View("Index", pProd));
     }
     catch (Exception ex)
     {
         Log.Error("Errore in fase di caricamneto HomePage", ex);
         ViewBag.ErrorMessage = "Username o Password errati";
         return(View("Index", pProd));
     }
 }