Ejemplo n.º 1
0
        public ActionResult GetEvents(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 = 100;
            }
            #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, "}");
            var    oRequestCode = new Random().Next(0, int.MaxValue);
            var    oRequestTime = DateTime.Now;
            LogHelper.InsertServiceLogs("search/opportunities (GetEvents) (" + oRequestCode + ")", Model, oRequestTime);

            //var events = FeedHelper.GetEventsDynamically(lat, lng, radius, sources, kinds, tags,
            //                                excludeTags, activities, disabilitySupports, days,
            //                                minCost, maxCost, gender, sortMode, minTime, maxTime,
            //                                minAge, maxAge, page, limit, from, to);

            #region Added for avoid individual call for database 28-01-2019
            var events = FeedHelper.GetEventsDynamically_V1(lat, lng, radius, sources, kinds, tags,
                                                            excludeTags, activities, disabilitySupports, days,
                                                            minCost, maxCost, gender, sortMode, minTime, maxTime,
                                                            minAge, maxAge, page, limit, from, to);
            #endregion
            LogHelper.InsertServiceLogs("search/opportunities (GetEvents) - Response (" + oRequestCode + ")", Model, oRequestTime, DateTime.Now);
            return(Ok(events));
        }