예제 #1
0
        public IActionResult Get()
        {
            if (Request.Query.ContainsKey("count"))
            {
                int count;
                if (Int32.TryParse(Request.Query["count"], out count))
                {
                    if (Request.Query.ContainsKey("isFoundation"))
                    {
                        var isFound = Convert.ToBoolean(Request.Query["isFoundation"]);
                        return(Ok(OfferRepository.GetN(count, isFound)));
                    }

                    else
                    {
                        return(BadRequest());
                    }
                }
            }
            if (Request.Query.ContainsKey("isFoundation"))
            {
                var isFound = Convert.ToBoolean(Request.Query["isFoundation"]);
                return(Ok(OfferRepository.GetAll(isFound)));
            }
            else
            {
                return(Ok(OfferRepository.GetAll(true)));
            }
        }