Exemplo n.º 1
0
        public ActionResult GetSessions(double?lat, double?lng, double?radius,
                                        [FromQuery] string[] source, [FromQuery] string[] kind, [FromQuery] string[] tag, [FromQuery] string[] excludeTag,
                                        [FromQuery] string[] activity, [FromQuery] string[] disabilitySupport, [FromQuery] string[] weekdays,
                                        double?minCost = null, double?maxCost = null, string gender = null, string sortMode = null,
                                        long?minTime   = null, long?maxTime   = null, long?minAge   = null, long?maxAge     = null,
                                        long?page      = 1, long?limit        = 50, string from = null, string to = null)
        {
            #region Variable declaration or assignment
            lat    = lat ?? defaultLatitude;
            lng    = lng ?? defaultLongitude;
            radius = radius ?? defaultRadius;
            string sources            = null;
            string kinds              = null;
            string tags               = null;
            string excludeTags        = null;
            string activities         = null;
            string disabilitySupports = null;
            string days               = null;

            if (source.Length > 0)
            {
                sources = string.Join(",", source);
            }
            if (kind.Length > 0)
            {
                kinds = string.Join(",", kind);
            }
            if (tag.Length > 0)
            {
                tags = string.Join(",", tag);
            }
            if (excludeTag.Length > 0)
            {
                excludeTags = string.Join(",", excludeTag);
            }
            if (activity.Length > 0)
            {
                activities = string.Join(",", activity);
            }
            if (disabilitySupport.Length > 0)
            {
                disabilitySupports = string.Join(",", disabilitySupport);
            }
            if (weekdays.Length > 0)
            {
                days = string.Join(",", weekdays);
            }
            if (page == null || page == 0)
            {
                page = 1;
            }
            if (limit == null || limit == 0)
            {
                limit = 50;
            }
            #endregion
            string Model = string.Concat("{lat:", lat, ",lng:", lng, ",radius:", radius, ",sources:", sources, ",kinds:", kinds, ",tags:", tags, ",excludeTags:", excludeTags, ",activitys:", activities, ",disabilitySupports:", disabilitySupports, ",days:", days, ",gender:", gender, ",minCost:", minCost, ",maxCost:", maxCost, ",from:", from, ",to:", to, ",page:", page, ",limit:", limit, ",minTime:", minTime, ",maxTime:", maxTime, ",minAge:", minAge, ",maxAge:", maxAge, "}");
            LogHelper.InsertServiceLogs("search/sessions (GetSessions)", Model);
            var events = FeedHelper.GetEvents(lat, lng, radius, sources, kinds, tags,
                                              excludeTags, activities, disabilitySupports, days,
                                              minCost, maxCost, gender, sortMode, minTime, maxTime,
                                              minAge, maxAge, page, limit, from, to);
            return(Ok(events));
        }