title: I am working on an API for a class I am in and I have a cannot convert error
body: <p>I am working on an API and I have an error that says &quot;cannot convert from &quot;HolidayChallenge.Models.Ornament.Ornament2Edit to HolidayChallenge.Data.Ornament2&quot;. The code follows:</p>
  <pre><code>[Route(&quot;api/Ornament2/Update&quot;)]
          public IHttpActionResult Put(Ornament2Edit ornament2)
          {
              if (!ModelState.IsValid)
              {
                  return BadRequest(ModelState);
              }
              var service = CreateOrnament2Service();
              if (!service.UpdateOrnament(ornament2)) //This is the line the error is on
              {
                  return InternalServerError();
              }
              return Ok(&quot;Your Ornament was updated!&quot;);
  </code></pre>
  <p>I am not sure how to fix this one. I have figured a lot of similar ones out but this one is fighting me. Any help would be much appreciated. Thank you in advance.
  <strong>Update to question</strong>
  OrnamentEdit:</p>
  <pre><code>namespace HolidayChallenge.Models.Ornament
  {
      public class Ornament2Edit
      {
          [Key]
          public int Id { get; set; }
          public string Description { get; set; }
          public int TreeId { get; set; }
      }
  }
  </code></pre>
  <p>Ornament2:</p>
  <pre><code>namespace HolidayChallenge.Data
  {
      public class Ornament2
      {
          [Key]
          public int Id { get; set; }
          public Guid UserId { get; set; }
          public string Description { get; set; }
          public virtual List&lt;Ornament2&gt; Ornaments { get; set; }
          [ForeignKey(&quot;ChristmasTree&quot;)]
          public int TreeId { get; set; }
          [Required]
          public virtual ChristmasTree ChristmasTree { get; set; }
      }
  }
  </code></pre>
  <p>Ornament2Service:</p>
  <pre><code> public bool UpdateOrnament(Ornament2 model)
          {
              using (var ctx = new ApplicationDbContext())
              {
                  var entity =
                      ctx
                          .Ornaments
                          .Single(e =&gt; e.Id == model.Id &amp;&amp; e.UserId == _userId);
                  entity.Id = model.Id;
                  entity.Description = model.Description;
                  entity.TreeId = model.TreeId;
  
                  return ctx.SaveChanges() == 1;
              }
          }
  </code></pre>