示例#1
0
        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));
        }
示例#2
0
        // GET: api/Batch
        public IHttpActionResult GetAllBatchs()
        {
            IEnumerable <object> batches = batchService.GetAll();

            return(Ok(batches));
        }