Меня пытались вызвать на пейджинг ASP.NET MVC он показывает эту ошибку
Severity Code Description Project File Line Suppression State Error CS0266 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<BOL.tbl_Url>' to 'System.Collections.Generic.List<BOL.tbl_Url>'. An explicit conversion exists (are you missing a cast?) What I have tried: <pre>using BLL; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace LinkHub.Areas.Common.Controllers { public class BrowseURLController : Controller { private UrlBs objBs; public BrowseURLController() { objBs = new UrlBs(); } // GET: Common/BrowseURL public ActionResult Index(string SortOrder, string SortBy, string Page) { ViewBag.SortOrder = SortOrder; ViewBag.SortBy = SortBy; var url = objBs.GetAll().Where(x => x.IsApproved == "A").ToList(); switch(SortBy) { case "Title": switch(SortOrder) { case "Asc": url = url.OrderBy(x => x.UrlTitle).ToList(); break; case "Desc": url = url.OrderByDescending(x => x.UrlTitle).ToList(); break; default: break; } break; case "Category": switch(SortOrder) { case "Asc": url = url.OrderBy(x => x.tbl_Category.CategoryName).ToList(); break; case "Desc": url = url.OrderByDescending(x => x.tbl_Category.CategoryName).ToList(); break; default: break; } break; case "Url": switch(SortOrder) { case "Asc": url = url.OrderBy(x => x.Url).ToList(); break; case "Desc": url = url.OrderByDescending(x => x.Url).ToList(); break; default: break; } break; case "UrlDesc": switch (SortOrder) { case "Asc": url = url.OrderBy(x => x.UrlDesc).ToList(); break; case "Desc": url = url.OrderByDescending(x => x.UrlDesc).ToList(); break; default: break; } break; default: url = url.OrderBy(x => x.UrlTitle).ToList(); break; } ViewBag.TotalPages = Math.Ceiling(objBs.GetAll().Where(x => x.IsApproved == "A").Count() / 10.0); int page = int.Parse(Page == null ? "1" : Page); ViewBag.Page = page; url =url.Skip((page - 1) * 10).Take(10); return View(url); } } }
вот я и получаю ошибку
url =url.Skip((page - 1) * 10).Take(10);