public ActionResult GetBatches(int id) { var query = _batchService.GetAll(); if (id == 0) { query = query.Where(b => b.EndDate == null); } else if (id == 1) { query = query.Where(b => b.EndDate != null); } var result = query.ToList().Select(x => new { x.Id, x.Name }).ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); }
// GET: api/Batch public IHttpActionResult GetAllBatchs() { IEnumerable <object> batches = batchService.GetAll(); return(Ok(batches)); }