title: Annoying errors with ASP.NET MVC - The Type or namespace name could not be found
body: <p>I'm new to ASP.NET MVC and I'm creating an app that will search a contact using using the autocomplete functionality along with jquery.</p>
  
  <p>When I run the project it loads fine and when i click the submit button to search a lastname i receive an error.   </p>
  
  <blockquote>
    <p>Server Error in '/' Application.<br>
    The resource cannot be found</p>
    
    <p>Requested URL:/Offender/Search</p>
  </blockquote>
  
  <p>While attempting this project i followed along witht Northwind MVC Sample and that project also gave me errors as well.  </p>
  
  <p>Any help is appreciated! Thanks</p>
  
  <p>The errors i receive are as follows:</p>
  
  <p>Error 1  </p>
  
  <blockquote>
    <p>The type or namespace name 'KOOLSModel' could not be found (are you missing a using directive or an assembly reference?)<br>
    C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\DOC_KOOLS\DOC_KOOLS\Controllers\OffenderController.cs  6   7   DOC_KOOLS</p>
  </blockquote>
  
  <p>Error 2</p>
  
  <blockquote>
    <p>The type or namespace name 'KOOLSEntities' could not be found (are you missing a using directive or an assembly reference?)<br>
    C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\DOC_KOOLS\DOC_KOOLS\Controllers\OffenderController.cs  15  32  DOC_KOOLS</p>
  </blockquote>
  
  <p>Error 3  </p>
  
  <blockquote>
    <p>The type or namespace name 'Offender' could not be found (are you missing a using directive or an assembly reference?)<br>
    C:\Documents and Settings\My Documents\Visual Studio 2008\Projects\DOC_KOOLS\DOC_KOOLS\Controllers\OffenderController.cs  32  22  DOC_KOOLS</p>
  </blockquote>
  
  <pre><code>using System;
  
  using System.Collections.Generic;
  
  using System.Linq;
  
  using System.Web;
  
  using System.Web.Mvc;
  
  using KOOLSModel;
  
  namespace DOC_KOOLS.Controllers
  {
      public class OffenderController : Controller
      {
          //
          // GET: /Offender/
          //KOOLSEntities KOOLS = new KOOLSEntities();
          KOOLSEntities db = new KOOLSEntities();
  
          public ActionResult Index()
          {
              ViewData["Message"] = "Welcome to KOOL!";
              return View();
          }
  
          public ActionResult getAjaxResult(string q)
          {
              string searchResult = string.Empty;
  
              var offender = (from o in db.Offender
                              where o.Lastname.Contains(q)
                              orderby o.LastName
                              select o).Take(10);
  
              foreach (Offender o in offender)
              {
                  searchResult += string.Format("{0}|\r\n", o.LastName);
              }
              return Content(searchResult);
          }
  
          [AcceptVerbs(HttpVerbs.Post)]
          public ActionResult Search(string searchTerm)
          {
              if (searchTerm == string.Empty)
              {
                  return View();
              }
              else
              {
                  //  if the search contains only one result retunr details
                  // otherwise a list
                  var offenders = from o in db.Offender
                                  where o.LastName.Contains(searchTerm)
                                  orderby o.LastName
                                  select o;
                  if (offenders.Count() == 0)
                  {
                      return View("notfound");
                  }
  
                  if (offenders.Count &gt; 1)
                  {
                      return View("List", offenders);
                  }
                  else
                  {
                      return RedirectToAction("Details", new { id = offenders.First().sPN });
                  }
              }
          }
          public ActionResult About()
          {
              return View();
          }
      }
  }
  </code></pre>