Exemplo n.º 1
0
		public ActionResult ListData()
		{
			var list = new TeamsDb().Teams.ToList();

			return Json(new { data = list }, JsonRequestBehavior.AllowGet);
		}
Exemplo n.º 2
0
        private static List<TeamViewModel> GetFilteredList(int? id = null)
        {
            var predicate = PredicateBuilder.True<Team>();
            if (id.HasValue)
            {
                predicate = predicate.And(s => s.Id == id.Value);
            }

            using (var db = new TeamsDb())
            {
                return db.Teams.AsExpandable().Where(predicate).OrderBy(t => t.Name).ToList().Select(t => TeamViewModel.FromTeam(t)).ToList();
            }
        }