Click here to Skip to main content
15,897,273 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: get same parameter twice Pin
miss7867-Jan-14 5:50
miss7867-Jan-14 5:50 
GeneralRe: get same parameter twice Pin
Richard Deeming7-Jan-14 8:03
mveRichard Deeming7-Jan-14 8:03 
GeneralRe: get same parameter twice Pin
miss7869-Jan-14 6:25
miss7869-Jan-14 6:25 
GeneralRe: get same parameter twice Pin
Richard Deeming9-Jan-14 7:50
mveRichard Deeming9-Jan-14 7:50 
GeneralRe: get same parameter twice Pin
miss78613-Jan-14 5:03
miss78613-Jan-14 5:03 
GeneralRe: get same parameter twice Pin
Richard Deeming13-Jan-14 7:49
mveRichard Deeming13-Jan-14 7:49 
GeneralRe: get same parameter twice Pin
miss78614-Jan-14 5:08
miss78614-Jan-14 5:08 
GeneralRe: get same parameter twice Pin
Richard Deeming14-Jan-14 10:59
mveRichard Deeming14-Jan-14 10:59 
Try moving the deal_type filter to the start:
C#
var data = db.database_ICs.AsQueryable();

// If a deal_type is specified, only return records for that deal type:
if (query.deal_type != null)
{
    data = data.Where(c => c.Type == query.deal_type);
}

// If any other filters are specified, return records which match any of them:
var filteredData = new List<IQueryable<database_IC>>();

if (!string.IsNullOrEmpty(query.name))
{
    var ids = query.name.Split(',');
    foreach (string i in ids)
    {
        filteredData.Add(data.Where(c => c.Name != null && c.Name.Contains(i)));
    }
}

if (!string.IsNullOrEmpty(query.id1))
{
    var ids = query.id1.Split(',');
    foreach (string i in ids)
    {
        filteredData.Add(data.Where(c => c.ID1 != null && c.ID1.Contains(i)));
    }
}

if (!string.IsNullOrEmpty(query.id2))
{
    var ids = query.id2.Split(',');
    foreach (string i in ids)
    {
        filteredData.Add(data.Where(c => c.ID2 != null && c.ID1.Contains(i)));
    }
}

// If no filters passed, return all data.
// Otherwise, combine the individual filters using the Union method
// to return all records which match at least one filter.
if (filteredData.Count != 0)
{
    data = filteredData.Aggregate(Queryable.Union);
}

if (!data.Any())
{
    var message = string.Format("No data was found");
    return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
}

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




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


GeneralRe: get same parameter twice Pin
miss78628-Jan-14 6:52
miss78628-Jan-14 6:52 
QuestionWhat is the best way for managing reports in Kentico CMS 7.0 Pin
Bhushan Patki19-Dec-13 0:32
Bhushan Patki19-Dec-13 0:32 
Answertemp Pin
Ya Rasoolallah18-Dec-13 12:56
Ya Rasoolallah18-Dec-13 12:56 
SuggestionRe: temp Pin
Richard MacCutchan18-Dec-13 22:00
mveRichard MacCutchan18-Dec-13 22:00 
Questionauto complete with ajaxcontroltoolkit and ado.net Pin
Ya Rasoolallah18-Dec-13 12:01
Ya Rasoolallah18-Dec-13 12:01 
AnswerRe: auto complete with ajaxcontroltoolkit and ado.net Pin
thatraja18-Dec-13 13:39
professionalthatraja18-Dec-13 13:39 
GeneralRe: auto complete with ajaxcontroltoolkit and ado.net Pin
Ya Rasoolallah18-Dec-13 14:05
Ya Rasoolallah18-Dec-13 14:05 
GeneralRe: auto complete with ajaxcontroltoolkit and ado.net Pin
thatraja18-Dec-13 14:22
professionalthatraja18-Dec-13 14:22 
GeneralRe: auto complete with ajaxcontroltoolkit and ado.net Pin
Ya Rasoolallah19-Dec-13 6:10
Ya Rasoolallah19-Dec-13 6:10 
AnswerRe: auto complete with ajaxcontroltoolkit and ado.net Pin
joginder-banger25-Dec-13 15:36
professionaljoginder-banger25-Dec-13 15:36 
QuestionAre there any good "substitute" ASP.Net lessons for "C# for programmers 2e"? Pin
That New Guy18-Dec-13 10:47
That New Guy18-Dec-13 10:47 
AnswerRe: Are there any good "substitute" ASP.Net lessons for "C# for programmers 2e"? Pin
Rahul Rajat Singh19-Dec-13 18:23
professionalRahul Rajat Singh19-Dec-13 18:23 
AnswerRe: Are there any good "substitute" ASP.Net lessons for "C# for programmers 2e"? Pin
abdul subhan mohammed21-Dec-13 3:44
professionalabdul subhan mohammed21-Dec-13 3:44 
Questionpass a value from custom text box control to controller Pin
Member 1040952418-Dec-13 10:01
Member 1040952418-Dec-13 10:01 
QuestionComplex UriTemplate for WCF Pin
Siva Kumar Balaguru 18-Dec-13 0:16
Siva Kumar Balaguru 18-Dec-13 0:16 
AnswerRe: Complex UriTemplate for WCF Pin
Rahul Rajat Singh19-Dec-13 18:21
professionalRahul Rajat Singh19-Dec-13 18:21 
QuestionI want column wise gridview paging Pin
Member 1006079517-Dec-13 21:04
Member 1006079517-Dec-13 21:04 

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.