title: How to call stored procedure in MVC controller ?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4259989/asp-net-mvc-best-way-to-call-stored-procedure">ASP.NET MVC: Best Way To Call Stored Procedure</a>  </p>
  </blockquote>
  
  
  
  <p>I am developing MCV3 application.</p>
  
  <p>I  want to call store procedure in one of the controller of the applicaiton. </p>
  
  <p>I have already saved store procedure in DB which I am using for applicaiton.</p>
  
  <p>The Query is </p>
  
  <pre><code>Create Procedure ConvertLeadToCustomer1
  @CompanyID int
  as
  begin 
  update Companies set __Disc__ = 'Customer' where CompanyID = @CompanyID
  end
  </code></pre>
  
  <p>Now, I wan to call this procesure into controller...</p>
  
  <pre><code>namespace CRMWeb.Controllers
  { 
      public class LeadController : Controller
      {
          private CRMWebContainer db = new CRMWebContainer();
  
          //
          // GET: /Lead/
  
          public ViewResult Index()
          {
              //return View(db.Companies.ToList());
              return View(db.Companies.OfType&lt;Lead&gt;().ToList());
  
          }
  
             public ActionResult Convert(int id)
          {
  
              // I want to write code here to call stored procedure...
  
  
          }
      }
  }
  </code></pre>
  
  <p>How to call it ? </p>