Click here to Skip to main content
15,887,485 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall Pin
kirthikirthi20-Nov-13 22:46
kirthikirthi20-Nov-13 22:46 
Questionasp.net Pin
Member 1026351919-Nov-13 21:14
Member 1026351919-Nov-13 21:14 
AnswerRe: asp.net Pin
Mycroft Holmes19-Nov-13 21:32
professionalMycroft Holmes19-Nov-13 21:32 
QuestionRe: asp.net Pin
Richard MacCutchan19-Nov-13 21:55
mveRichard MacCutchan19-Nov-13 21:55 
QuestionFromUri Method - API Pin
miss78619-Nov-13 0:38
miss78619-Nov-13 0:38 
AnswerRe: FromUri Method - API Pin
Richard Deeming19-Nov-13 2:12
mveRichard Deeming19-Nov-13 2:12 
GeneralRe: FromUri Method - API Pin
miss7865-Dec-13 23:55
miss7865-Dec-13 23:55 
GeneralRe: FromUri Method - API Pin
Richard Deeming6-Dec-13 1:33
mveRichard Deeming6-Dec-13 1:33 
miss786 wrote:
If search by name=storm and price_type=talk, it produces results with all talk categories instead of filtering by name.storm + price_type.talk.

That's because you're using || (OR) to combine your filters. If you only want to return data which matches all of the filters, then you need to use && (AND) to combine them.

However, based on your URL, it looks like the filters are optional, and you only want to match the filters which have been passed in. In that case, you'll need to check each filter individually, so a series of chained Where calls is probably the simplest option:

C#
var data = db.database_BWICs.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 (query.isin != null)
{
    data = data.Where(c => c.ISINs == query.isin);
}
if (query.price_type != null)
{
    data = data.Where(c => c.Cover == query.price_type);
}

if (!data.Any()) // NB: data will never be null.
{
    var message = string.Format("No database_WICs was found");
    return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
}

return Request.CreateResponse(HttpStatusCode.OK, data);


You might need to change the filter tests, depending on the data types of the fields.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionSuggest me a website in asp dotnet Pin
Member 1041107418-Nov-13 23:15
Member 1041107418-Nov-13 23:15 
AnswerRe: Suggest me a websit in asp dotnet Pin
Chris Quinn18-Nov-13 23:22
Chris Quinn18-Nov-13 23:22 
AnswerRe: Suggest me a website in asp dotnet Pin
Dineshshp18-Nov-13 23:39
professionalDineshshp18-Nov-13 23:39 
AnswerRe: Suggest me a website in asp dotnet Pin
Chris Quinn19-Nov-13 0:42
Chris Quinn19-Nov-13 0:42 
AnswerRe: Suggest me a website in asp dotnet Pin
thatraja19-Nov-13 1:09
professionalthatraja19-Nov-13 1:09 
AnswerRe: Suggest me a website in asp dotnet Pin
Abhinav S19-Nov-13 16:56
Abhinav S19-Nov-13 16:56 
QuestionDropdown list based on another dropdown list. Pin
Member 1040983818-Nov-13 10:20
Member 1040983818-Nov-13 10:20 
AnswerRe: Dropdown list based on another dropdown list. Pin
Richard Deeming19-Nov-13 2:07
mveRichard Deeming19-Nov-13 2:07 
QuestionASP.NET QUESTION PERSONAL PROJECT Pin
cserakeshcseranjan18-Nov-13 4:30
cserakeshcseranjan18-Nov-13 4:30 
AnswerRe: ASP.NET QUESTION PERSONAL PROJECT Pin
Joshua Omundson18-Nov-13 4:58
Joshua Omundson18-Nov-13 4:58 
AnswerRe: ASP.NET QUESTION PERSONAL PROJECT Pin
thatraja18-Nov-13 4:59
professionalthatraja18-Nov-13 4:59 
QuestionHow does IIS recognize that request is for MVC Controllers or webforms Pages? Pin
sanjay24365718-Nov-13 4:08
sanjay24365718-Nov-13 4:08 
QuestionJanus GridEx + asp.net Pin
jojoba201118-Nov-13 4:00
jojoba201118-Nov-13 4:00 
QuestionRe: Janus GridEx + asp.net Pin
thatraja18-Nov-13 4:32
professionalthatraja18-Nov-13 4:32 
QuestionRe: Janus GridEx + asp.net Pin
jojoba201119-Nov-13 18:05
jojoba201119-Nov-13 18:05 
QuestionADO.NET Pin
rock_monu17-Nov-13 21:58
rock_monu17-Nov-13 21:58 
AnswerRe: ADO.NET Pin
Rockstar_17-Nov-13 22:26
professionalRockstar_17-Nov-13 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.