public async Task <IActionResult> EditProduto(int id) { string statusModel = null; var marcas = await _marcaAppServices.GetAllAsync(); var materiais = await _materialAppServices.GetAllAsync(); var listaFotos = await _produtoFotoAppServices.RetornarListaFotoInput(id); var cores = await _produtoCorAppServices.GetByProdutoAsync(id, null); var listaCores = await _produtoCorAppServices.RetornarListaDeCorDoProduto(id, null); var produto = await _produtoAppServices.GetByIdAsync(id); var corSelect = await _corAppServices.GetAllAsync(); if (TempData["Error"] != null) { statusModel = "Error"; ModelState.AddModelError(string.Empty, TempData["Error"].ToString()); } else if (TempData["Success"] != null) { statusModel = "Success"; ModelState.AddModelError(string.Empty, TempData["Success"].ToString()); } return(View("Edit", new ProdutoEditViewModel(marcas, materiais, listaFotos, cores, listaCores, corSelect, produto, id, statusModel))); }
public async Task <ActionResult> Index(List <ProdutoViewModel> produtoViewModel, FiltroProdutoViewModel filtro, int pagina = 1) { IEnumerable <ProdutoViewModel> produtos; if (produtoViewModel.Any()) { produtos = produtoViewModel; } else { produtos = await _produtoAppServices.GetAllAsync("AT"); } var statusModel = "Success"; if (TempData["Error"] != null) { statusModel = "Error"; ModelState.AddModelError(string.Empty, TempData["Error"].ToString()); } var produtoViewModels = await produtos.ToList().ToPagedListAsync(pagina, 24); var produtoCorViewModel = await _produtoCorAppServices.GetAllGroupedAsync("AT"); var marcaViewModel = await _marcaAppServices.GetAllAsync(); var materialViewModel = await _materialAppServices.GetAllAsync(); return(View("Index", new ProdutoIndexViewModel(produtoViewModels, produtoCorViewModel, marcaViewModel, materialViewModel, filtro, statusModel))); }
public async Task <ActionResult> Index() { CreateSitemapInRootDirectory(); var marcas = await _marcaAppServices.GetAllAsync(); var marcaPeople = 0; var marcaPrestige = 0; var marcaAzzaro = 0; foreach (var item in marcas) { if (item.Nome.ToLower() == "people") { marcaPeople = item.Id; } else if (item.Nome.ToLower() == "prestige") { marcaPrestige = item.Id; } else if (item.Nome.ToLower() == "azzaro") { marcaAzzaro = item.Id; } } var carrosselPrestige = await _produtoAppServices.GetCategoryForHomeAsync("bestSeller", marcaPrestige); var carrosselPeople = await _produtoAppServices.GetCategoryForHomeAsync("bestSeller", marcaPeople); var carrosselAzzaro = await _produtoAppServices.GetCategoryForHomeAsync("bestSeller", marcaAzzaro); return(View(new HomeViewModel(carrosselPeople, carrosselPrestige, carrosselAzzaro))); }
public async Task <IActionResult> Index(string termo, int pagina = 1) { IEnumerable <MarcaViewModel> listaMarcas; if (termo == null) { listaMarcas = await _marcaAppServices.GetAllAsync(); } else { listaMarcas = await _marcaAppServices.Filter(termo); } var listaPaged = await listaMarcas.ToList().ToPagedListAsync(pagina, 20); return(View(new MarcaListAdmViewModel(listaPaged, termo))); }
public async Task <IViewComponentResult> InvokeAsync() { var marcas = await _marcaAppServices.GetAllAsync(); return(View(new MenuViewModel(marcas))); }