Ejemplo n.º 1
0
        public IHttpActionResult Get(string searchQuery)
        {
            //return events;
            using (Contexts.GonnaWannaContext ctx = new Contexts.GonnaWannaContext())
            {
                var eventQuery = ctx.Events
                    .Where(e => e.Description.Contains(searchQuery) || e.Name.Contains(searchQuery))
                    .Include(e => e.Location)
                    //.Include(e => e.)
                    .ToList();

                var channelQuery = ctx.Channels
                    .Where(c => c.Description.Contains(searchQuery) || c.Name.Contains(searchQuery))
                    //.Include(e => e.)
                    .ToList();

                var query = new
                {
                    eventResults = eventQuery,
                    channelResults = channelQuery
                };

                return Ok(query);
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult Get()
        {
            using (Contexts.GonnaWannaContext ctx = new Contexts.GonnaWannaContext())
            {
                var query = ctx.Locations
                    .Include(l => l.Events)
                    //.Include(e => e.)
                    .ToList();

                return Ok(query);
            }
        }
Ejemplo n.º 3
0
        public IHttpActionResult Get()
        {
            using (Contexts.GonnaWannaContext ctx = new Contexts.GonnaWannaContext())
            {
                var query = ctx.Channels
                    .Include(c => c.ChannelMemberships.Select(cm => cm.Event))
                    //.Include(e => e.)
                    .ToList();

                return Ok(query);
            }
        }
Ejemplo n.º 4
0
        public IHttpActionResult Get(int id)
        {
            using (Contexts.GonnaWannaContext ctx = new Contexts.GonnaWannaContext())
            {
                var query = ctx.Locations
                .Include(l => l.Events)
                //.Include(e => e.)
                .FirstOrDefault((l) => l.ID == id);

                if (query == null)
                {
                    return NotFound();
                }

                return Ok(query);
            }
        }
Ejemplo n.º 5
0
        public IHttpActionResult Get(int id)
        {
            using (Contexts.GonnaWannaContext ctx = new Contexts.GonnaWannaContext())
            {
                //var query = from e in ctx.Events
                //         select e;

                var query = ctx.Events
                .Include(e => e.Location)
                .Include(e => e.ChannelMemberships.Select(cm => cm.Channel))
                //.Include(e => e.)
                .FirstOrDefault((e) => e.ID == id);

                if (query == null)
                {
                    return NotFound();
                }

                return Ok(query);
            }
        }
Ejemplo n.º 6
0
        public IHttpActionResult Get(int id)
        {
            using (Contexts.GonnaWannaContext ctx = new Contexts.GonnaWannaContext())
            {

                var query = ctx.Channels
                //.Include(c => c.)
                .Include(c => c.ChannelMemberships.Select(cm => cm.Event))
                .Include(c => c.ChannelMemberships.Select(cm => cm.Event.Location))

                //.Include(e => e.)
                .FirstOrDefault((c) => c.ID == id);

                if (query == null)
                {
                    return NotFound();
                }

                return Ok(query);
            }
        }