private bool ValidateRequest(int?id, ListifyFilterModel filter)
 {
     if ((!filter.MinValue.HasValue && !filter.MaxValue.HasValue) || (filter.MinValue.HasValue && filter.MaxValue.HasValue && filter.MaxValue > filter.MinValue))
     {
         if (id.HasValue && ((filter.MinValue.HasValue && filter.MaxValue.HasValue && id.Value > (filter.MaxValue - filter.MinValue))))
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
        public IActionResult Get(int id, [FromQuery] ListifyFilterModel filter)
        {
            if (!ValidateRequest(id, filter))
            {
                return(BadRequest());
            }

            try
            {
                var minValue = filter.MinValue ?? 0 + id;
                var maxValue = filter.MaxValue ?? minValue + id + 100;

                var list = new Listify(minValue, maxValue);

                return(Ok(list[id]));
            }
            catch (IndexOutOfRangeException iorException)
            {
                return(BadRequest(iorException.Message));
            }
        }
        public IActionResult GetAll([FromQuery] ListifyFilterModel filter)
        {
            if (!ValidateRequest(null, filter))
            {
                return(BadRequest());
            }

            try
            {
                var minValue = filter.MinValue ?? 0;
                var maxValue = filter.MaxValue ?? minValue + 100;

                var list = new Listify(minValue, maxValue);

                return(Ok(list.AsEnumerable()));
            }
            catch (IndexOutOfRangeException iorException)
            {
                return(BadRequest(iorException.Message));
            }
        }