title: Web API to call the stored Procedure and return Result
body: <p>I am creating a Web API that accepts two input parameter called ACC. Created a stored procedure to insert or update the Account table in the SQL server. Account table has just two fields AccountID nvarchar(50) (primaryKey) and Cnt int</p>
  
  <pre><code> CREATE PROCEDURE [dbo].[usp_InserUpadte] 
   @Account_TT AS Account_TT READONLY
  
   AS
   BEGIN
   SET NOCOUNT ON;
  
   BEGIN TRANSACTION;
  
   MERGE dbo.[Account] prj
   USING @Account_TT tt
   ON prj.AccountID = tt.AccountID
   WHEN MATCHED THEN UPDATE SET prj.Cnt = prj.Cnt+1
   WHEN NOT MATCHED THEN INSERT (AccountID,Cnt)
   VALUES (tt.AccountID, 1);
  
   COMMIT TRANSACTION;
  </code></pre>
  
  <p>Now I tried to connect to the SQL server not sure how to how would I call the stored procedure into the ASP.NET Web API application and pass the Account ID in it to create or updadte the table</p>
  
  <pre><code>namespace WebService.Controllers
  {
  public class CreationController : ApiController
  {
      [HttpGet]
      public HttpResponseMessage Get(string ACC)
      {
          string strcon =  System.Configuration.ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString;
          SqlConnection DbConnection = new SqlConnection(strcon);
  </code></pre>
  
  <p>I know we can call the query directly like </p>
  
  <pre><code>var strQuery = "SELECT * from ACCOUNT where ACC = :ACC"
  </code></pre>
  
  <p>But dont know how to call the above stored procedure and pass the Account Value. Any help is greatly appreciated.</p>