title: The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'IMS.Models.Dealer'
body: <p>I know there are a lot of similar questions here, but none of them could solve my problem.</p>
  
  <p><strong>When I access</strong> the URL: <a href="http://localhost:42626/dealer/edit/2" rel="nofollow">http://localhost:42626/dealer/edit/2</a></p>
  
  <p><strong>Error occurs:</strong></p>
  
  <blockquote>
    <p>The model item passed into the dictionary is of type 'System.Int32',
    but this dictionary requires a model item of type 'IMS.Models.Dealer'.</p>
  </blockquote>
  
  <p><strong>DealerController Code:</strong></p>
  
  <pre><code>[HttpGet]
  public ActionResult Edit(int DealerId = 0)
  {
      //get from database
      Models.Dealer dealer = new Models.Dealer();
      string Error;
      if(dealer.GetDealer(DealerId, out Error))
          return View(dealer);
      else
      {
          RedirectToAction("Index");
      }
  
      return View(DealerId);
  }
  
  [HttpPost]
  public ActionResult Edit(Models.Dealer dealer)
  {
      //if All validations are true
      if (ModelState.IsValid)
      {
          string Error;
          //save to database
          if(dealer.Save(out Error))
              return RedirectToAction("Index");
          else
          {
              TempData["EditMessage"] = "An error occured. Could not update Dealer. Details: " + Error;
              return Edit(dealer.Id);
          }
      }
  
      return Edit(dealer.Id);
  }
  </code></pre>
  
  <p>I've created <code>View</code> with strongly typed <code>Models.Dealer</code> and template is <code>Edit</code>.</p>
  
  <p>If I have defined <code>[HttpGet]</code> and <code>[HttpPost]</code>, why is it not accepting <code>int</code> and keep asking for <code>Dealer</code> model??</p>