Web API Controller POST Request LINQ search through String Array


I have the following database structure.



src="http://i.imgur.com/19rZ0W1.png" alt="structure">



Sorry for the horrible MS Paint Work



I am using .NET Framework 4.6.1 Web API Controller using Entity
Framework.



My API Controller handles a post request that receives a structure
similar to:



{  "countryCode": "CA", "languageCode": "EN ","partTypes":
"Brakes", "partComponents": "Relay" }


^^ Above request should find Part ID = 1 , and I want to select
Part Request URL



{ "countryCode": "US","languageCode": "EN ","partTypes": "
Brakes , Clutch", "partComponents": "Relay"}


^^ Above request should find Part ID = 1 & 2 , and I want to
select Part Request URL for both.



“Clutch, Resistor, EN, US” Should find Part ID = 2 etc.



My Question is how am I able to use LINQ to SQL or
<IQueryable> to return the part ID for whatever
post request is captured by the controller.
The current code I have been working on so far looks similar to
this:



Inside API Controller:



public string Post(PostProfile postProfile) 
string[] partURLArray;
{
using (var context = new context())
{partURLArray = context.ViewName
.Where(fields = >
field.CountryCode.Contains(postProfile.countryCode)
.Where(fields =>
fields.LanguageCode.Contains(postProfile.languageCode)
.Select(fields => fields.PartRequestURL).ToArray();
}
foreach
(var part in partURLArray)
{
//do some stuff
}
return partString
}


Post Profile Model Class:



    public string countryCode { get; set; }
public string languageCode { get; set; }
public string[] partType { get; set; }
public string[] partComponents { get; set; }

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ PHP
+ ASP/ASP.Net
+ C/C++/C#
+ VB/VB.Net
+ JAVA
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow