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