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))); } }
public IActionResult Create() { var query = Request.Query["query"]; var isFound = Convert.ToBoolean(Request.Query["isFoundation"]); if (String.IsNullOrWhiteSpace(query)) { return(Ok(OfferRepository.GetAll(isFound))); } else { return(Ok(OfferRepository.GetByQueryInProds(query, isFound))); } }
public IHttpActionResult GetAll() { return(Ok(offerRepository.GetAll())); }