Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

call from uri methods from business logic layer

$
0
0

I would like to know how to call from uri methods from business logic layer. This is what I have so far and I am getting few compilers error. if someone could direct to right approach/framework to construct the following:

Data class

public Results GetData(Query query)
        {

            var data = db.database.AsQueryable();

            if (query.name != null)
            {
                data = data.Where(c => c.Name == query.name);
            }
            if (query.cusip != null)
            {
                data = data.Where(c => c.CUSIP == query.cusip);
            }

            if (!data.Any())
            {
                return data.AsQueryable();
            }

        }

Data Api Controller:

public HttpResponseMessage GetMulti([FromUri]Query query)
        {
            Data layer = new Data();

                var result = layer.GetData(query);
                
                var message = string.Format("No data was found");
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);

        }

Many thanks


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>