Cannot implicitly convert type 'string' to 'long'
<p>I have two tables in my MS Sql database, Course and StudyCase, with a FK ID (Course table) to Course_ID (in the StudyCase table).  I am trying to find the StudyCase ID from the Course id.</p>

<p>In the Repository:</p>

<pre><code>  public IQueryable&lt;StudyCase&gt; ListStudyCases(long courseId)
        {
            return _dbContext.StudyCases.Where(c =&gt; c.Course_ID == courseId);
        }
</code></pre>

<p>In the StudyCases Services:</p>

<pre><code>public IQueryable&lt;StudyCase&gt; ListStudyCases(long courseId)
    {
        return this._StudyCaseRepository.ListStudyCases(courseId);
    }
</code></pre>

<p>In the StudyCases IServices:</p>

<pre><code> IQueryable&lt;StudyCase&gt; ListStudyCases(long courseId);
</code></pre>

<p>Sending the action from the course controller:</p>

<pre><code> return RedirectToAction("Index", "CourseCases", new { courseId = 6 });
</code></pre>

<p>In the StudyCase Controller:</p>

<pre><code>    public ActionResult Index(long courseId)
        {
            string id = "";
            id = _studyCaseSvc.ListStudyCases(courseId).First().ID.ToString();
            StudyCase cases = _studyCaseSvc.GetStudyCase(id);
...
</code></pre>

<p>I get the following two error:</p>

<pre><code>Cannot implicitly convert type 'string' to 'long'
</code></pre>

<p>and </p>

<pre><code>The best overloaded method match for 'IStudyCaseService.GetStudyCase(long)' has some invalid arguments
</code></pre>

<p>Would appreciate your help.</p>
