I\'m trying to decide which is the best way to call a stored procedure.
I\'m new to ASP.NET MVC and I\'ve been reading a lot about Linq to SQL and Entity Framework,
Try this:
Read:
var authors = context.Database.SqlQuery("usp_GetAuthorByName @AuthorName",
new SqlParameter("@AuthorName", "author"));
Update:
var affectedRows = context.Database.ExecuteSqlCommand
("usp_CreateAuthor @AuthorName = {0}, @Email= {1}",
"author", "email");
From this link: http://www.dotnetthoughts.net/how-to-execute-a-stored-procedure-with-entity-framework-code-first/
And I would go with the framework David Lively mentioned, instead of having the routines in the controller. Simply pass the results back as IEnumerable from a function in a separate repository class for an edit, pass a boolean back for if the update succeeded for an update.