示例#1
0
    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);
    }
示例#3
0
    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);
    }