.OrderBy(p = > (p.Keywords.Split('')).
, . String.Split() SQL.
Linq-to-Sql. L2S, < > , .
var jobs = from p in _dataContext.Jobs
select new
{
p.Title,
p.IsFullTIme,
p.Location,
p.Category,
p.Url,
p.Id,
p.Keywords
}
return Json(job.ToList()
.OrderBy(p=>p.Keywords.Split(' ').Where(n=>k.Contains(n)).Count()),
JsonRequestBehavior.AllowGet);
, . JobKeywords (int JobId, varchar Keyword) . sql:
return Json(from p in _dataContext.Jobs
order by p.Keywords.Intersect(k).Count()
select new { p.Title, p.IsFullTime, p.Location,
p.Category, p.Url, p.Id },
JsonRequestBehavior.AllowGet);