public async Task <IActionResult> Search(ProductListingViewModel model) { return(View(new ProductListingViewModel { Search = model.Search, Products = await this.products.SearchAsync(model.Search) })); }
public async Task <IViewComponentResult> InvokeAsync(int take) { var model = new ProductListingViewModel { Products = await this.productService.LatestProductsAsync(take) }; return(View(model)); }
public async Task <IActionResult> All(int page = 1) { var model = new ProductListingViewModel { Products = await this.productService.AllProductsAsync(page), TotalProducts = await this.productService.TotalAsync(), CurrentPage = page }; return(View(model)); }
public ActionResult Index() { var model = new ProductListingViewModel { Categories = new SelectList(new[] { new { Value = "1", Text = "category 1" }, new { Value = "2", Text = "category 2" } }, "Value", "Text") }; return(View(model)); }
protected override void OnStartup(StartupEventArgs e) { ProductStore productStore = new ProductStore(); CreateProductViewModel createProductViewModel = new CreateProductViewModel(productStore); ProductListingViewModel productListingViewModel = new ProductListingViewModel(productStore); MainViewModel mainViewModel = new MainViewModel(createProductViewModel, productListingViewModel); MainWindow = new MainWindow() { DataContext = mainViewModel }; MainWindow.Show(); base.OnStartup(e); }
public ProductListingPage() { InitializeComponent(); NavigationPage.SetHasBackButton(this, false); BindingContext = new ProductListingViewModel(); //language if (App.lang == "ar-AE") { this.FlowDirection = FlowDirection.RightToLeft; } else { this.FlowDirection = FlowDirection.LeftToRight; } }
public ActionResult Index() { //try { var viewModel = new ProductListingViewModel(); viewModel.Products = Mapper.Map <List <ProductViewModel> >(_productService.GetProducts()); viewModel.Products.ForEach(p => p.Image = _pathUtilites.ToAbsolute(string.Format("~/img/Products/{0}.png", p.ArticleNr))); return(View(viewModel)); } //catch(Exception exp) //{ // Logger.Error(exp); //} //return View(); }
public async Task <IActionResult> Details(int id) { var product = await _productsService.FindProductAsync(id); var viewModel = new ProductListingViewModel(product) { Comments = await _commentService.GetCommentsFromProductAsync(id) }; foreach (var comment in viewModel.Comments) { comment.Account = await _accountsService.FindAccountAsync(comment.AccountId); } if (TempData != null && (string)TempData["StatusMessage"] != "") { StatusMessage = (string)TempData["StatusMessage"]; } return(View(viewModel)); }
public ActionResult Index(string Category = null) { List <Product> products; List <ProductCategory> categories = productCategories.Collection().ToList(); if (Category == null) { products = context.Collection().ToList(); } else { products = context.Collection().Where(p => p.Category == Category).ToList(); } ProductListingViewModel productListingModel = new ProductListingViewModel(); productListingModel.Product = products; productListingModel.ProductCategories = categories; return(View(productListingModel)); }
private ProductListingViewModel GetProductViewModelForQuickView(Product product, Sku sku) { if (sku != null) { var model = new ProductListingViewModel { Url = Url.ProductUrl(product), Name = product.Name, FullName = sku.Name, ProductCode = sku.Code, SkuId = sku.Id, Attributes = sku.Attributes.ToDictionary(t => t.Key, t => t.Value), IsNew = sku.IsNew }; if (sku.Images.Any()) { model.ImageAssetId = sku.Images.OrderBy(t => t.Order).FirstOrDefault().ImageAssetID; } return(model); } return(null); }
public ActionResult Index(ProductListingViewModel model) { return(View(model)); }