title: (MVC C#)Advice on my Maintenance Scheduling system with Maintenance Records
body: <p>I have this maintenance scheduling system, and in im using MVC C# Entity Framework, </p>
  
  <p>I have this table
  Truck Table that has - truck id, registration no., kilometer run reading, and i have an JobOrder Table, i want to get the truck id in the truck table so that i can add a JobOrder on a specific Truck i have this JobOrder Controller</p>
  
  <pre><code>public ActionResult AddJobOrder(JobOrderModel jo, int id)
  {
      var AddJobOrder = db.trucks.FirstOrDefault(s =&gt; s.id == id);
  
      var addjo = new joborder()
          {
              truck_no = AddJobOrder,
              description = jo.Description,
              worked_performed = jo.worked_performed,
              quantity = jo.Quantity,
              spare_parts = jo.SpareParts,
              run = jo.kilometer_run,
              date_finished = jo.DateFinished,
              date_started = jo.DateFinished,
          };
  
      if (!ModelState.IsValid)
      {
          db.joborders.Add(addjo);
          db.SaveChanges();
          return View(jo);
  
      }
      return View(jo);
  
  }
  </code></pre>
  
  <p>I receive the following error:</p>
  
  <blockquote>
    <p>Error 4   Cannot implicitly convert type 'Pms_system.truck' to 'int'  </p>
  </blockquote>
  
  <p>This is my model</p>
  
  <pre><code>public class JobOrderModel
  {
      public int truck_no { get; set; }
      public DateTime DateStarted { get; set; }
      public DateTime DateFinished { get; set; }
      public string SpareParts { get; set; }
      public int Quantity { get; set; }
      public string Description { get; set; }
      public int kilometer_run { get; set; }
      public string worked_performed { get; set; }
  
  }
  </code></pre>
  
  <p>Please help me to get the truck id.</p>