public ActionResult SortProductsBy(string selectedOption, string view) { List <StoreDomainModel> sortedProductsListDM = storeBusiness.SortProductsBy(selectedOption); List <StoreViewModel> sortedProductsListVM = new List <StoreViewModel>(); AutoMapper.Mapper.Map(sortedProductsListDM, sortedProductsListVM); if (view == "grid") { return(PartialView("_Products", sortedProductsListVM)); } else { return(PartialView("_ProductsList", sortedProductsListVM)); } }