Skip to content

Instantly share code, notes, and snippets.

@venblee
Created June 21, 2013 16:29
Show Gist options
  • Save venblee/5832429 to your computer and use it in GitHub Desktop.
Save venblee/5832429 to your computer and use it in GitHub Desktop.
Running Store Proc Code First
{
try
{
using (var db = new PmsContext())
{
var pa = db.PostalCodes.Distinct().Where(x => x.town.Contains(searchTerm)).ToList();
SqlParameter categoryParam = new SqlParameter("@searchTerm", searchTerm);
var cities = db.Database.SqlQuery<List<Models.PostalCode>>("SearchCity @searchTerm", categoryParam).ToList();
// return db.PostalCodes.Where(x => x.town.Contains(searchTerm)).Distinct().ToList();
return null;
}
}
catch (Exception ex)
{
}
return new List<Models.PostalCode>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment