//Filtri e premere CERCA public async Task InsertProduct() { // Arrange UserBL userBL = new UserBL(); userBL.SetGoogleCedential(); Models.Product wProdotto = new Models.Product(); wProdotto.Category = "Uomo"; wProdotto.Brand = "armani"; wProdotto.ProductName = "Pantalone"; wProdotto.Color = "Bianco"; wProdotto.Description = "pantalone bello"; wProdotto.Headmoney = "L"; wProdotto.Price = 60.00; wProdotto.Quantity = 30; wProdotto.Model = "Pantalone"; wProdotto.Image = @"C:\Users\feder\Desktop\Ingegneria del Software\pantalone bianco.png"; ProductBL wDB = new ProductBL(); await wDB.InsertProduct(ProductEntityToProductModel.ConvertoProdyctEntityTOProductModel(wProdotto), ""); Models.SearchProduct wFilter = new Models.SearchProduct(); wFilter.ProductName = "pantalone"; List <Product> wListProduct = ProductEntityToProductModel.ConvertoListProdyctEntityTOListProductModel(await wDB.GetListProducts(ProductEntityToProductModel.ConvertoProdyctEntityTOSearchProductModel(wFilter))); Assert.IsTrue(wListProduct.Count > 0); }
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()); } }