Exemplo n.º 1
0
        public async Task<IHttpActionResult> GetAsync([FromUri] double longitude, [FromUri] double latitude, [FromUri] double radius)
        {
            var criteria = new KnockCriteria()
            {
                Location = new Location()
                {
                    Latitude = latitude,
                    Longitude = longitude
                },
                Radius = radius
            };
            var knocks = (await Repository.GetKnocksAsync(criteria)).ToArray();

            if (!knocks.Any())
            {
                return Ok();
            }
            return Ok(knocks);
        }
Exemplo n.º 2
0
        public async Task<IHttpActionResult> GetAsync([FromUri] string feedId)
        {
            var criteria = new KnockCriteria()
            {
                FeedId = feedId
            };

            Knock[] knocks;
            try
            {
                knocks = (await Repository.GetKnocksAsync(criteria)).ToArray();
            }
            catch (Exception exception)
            {
                return InternalServerError(exception);
            }

            if (!knocks.Any())
            {
                return Ok();
            }

            return Ok(knocks);
        }