public static ProductUserSearchDto ToDto(this ProductUserSearchViewModel source) { return(new ProductUserSearchDto { CategoryId = source.CategoryId, PageNumber = source.PageNumber, PageSize = source.PageSize, Title = source.Title }); }
public IActionResult Index(ProductUserSearchViewModel searchModel) { var serviceResult = _userService.GetProducts(searchModel.ToDto()); if (!serviceResult.IsSuccess) { Swal(false, "دسته بندی یافت نشد"); return(RedirectPermanent("/")); } ViewBag.CategoryName = serviceResult.Data.CategoryName; return(View_Search(searchModel, serviceResult.Data.Products.ToViewModel())); }
public IActionResult Search(ProductUserSearchViewModel searchModel) { var data = _userService.SearchProducts(searchModel.ToDto()); return(View_Search(searchModel, data.ToViewModel())); }