public virtual async Task <IActionResult> ProductsByTag(int productTagId, CatalogProductsCommand command) { var productTag = await _productTagService.GetProductTagByIdAsync(productTagId); if (productTag == null) { return(InvokeHttp404()); } var model = await _catalogModelFactory.PrepareProductsByTagModelAsync(productTag, command); return(View(model)); }
//in versions 3.00-4.00 we had ID in product tag URLs /// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> RedirectProductTagById(int productTagId) { var productTag = await _productTagService.GetProductTagByIdAsync(productTagId); if (productTag == null) { return(RedirectToRoutePermanent("Homepage")); } return(RedirectToRoutePermanent("ProductsByTag", new { SeName = await _urlRecordService.GetSeNameAsync(productTag) })); }
/// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> RedirectProductTag(string id, bool idIncludesSename = true) { //we can't use dash in MVC var tagId = idIncludesSename ? Convert.ToInt32(id.Split(new[] { '-' })[0]) : Convert.ToInt32(id); var tag = await _productTagService.GetProductTagByIdAsync(tagId); if (tag == null) { return(RedirectToRoutePermanent("Homepage")); } return(RedirectToRoutePermanent("ProductsByTag", new { productTagId = tag.Id })); }