I am building an MVC-based e-commerce application with MVC3 based on nopCommerce. I am needing to restrict the sale of certain products based on zip code. For example, the sale of slingshots is illegal in New Mexico, so if you try and purchase a slingshot from our sight and your zip code is from New Mexico, you are redirected to your shopping cart and informed you cannot purchase the product.
To accomplish this, I have created a SQLCE database of zip codes and given them a bool value of Restricted. I want to take the zip code given by the customer during the checkout process and compare it to the database I have created, determining whether or not it is restricted. Then I will use if statements to handle the order based on the results.
I am new to MVC3 and .Net in general, so my experience is practically null. My research seems to indicate there are several methods for doing this(Linq To SQL, Entity Frameworks, ETC). Is this true? What is the most efficient what to accomplish this comparison?
Edit
After further reading I will make my question more concrete. How do I ask the db “Hey, do you have this zip?” using Linq to Entities?
The answer to your question can be as simple as this:
Linq-to-Entities converts Linq expressions to SQL statements.
However, there is a learning curve when setting up Entity Framework for the first time, so take that into consideration.