public IQueryable <Category> GetCategories() { var _db = new Onevent.Models.EventContext(); IQueryable <Category> query = _db.Categories; return(query); }
public IQueryable <Event> GetEvents([QueryString("id")] int?categoryId) { var _db = new Onevent.Models.EventContext(); IQueryable <Event> query = _db.Events; if (categoryId.HasValue && categoryId > 0) { query = query.Where(p => p.CategoryID == categoryId); } return(query); }
public IQueryable <Event> GetEvent([QueryString("eventID")] int?eventId) { var _db = new Onevent.Models.EventContext(); IQueryable <Event> query = _db.Events; if (eventId.HasValue && eventId > 0) { query = query.Where(p => p.EventID == eventId); } else { query = null; } return(query); }