title: Delete row ASP.NET MVC ADO.NET entity Model
body: <p>I'm kinda newbie with asp.net MVC environment</p>
  
  <p>i'm trying to delete ROW from 3 table/entity(cause i'm using ado.net entity data model to generate the database automatically) the problem is when my delete function is executed only ROW from 1 table is deleted..</p>
  
  <p>PS: i've also already create the relationship between 3 table</p>
  
  <p>here is my controller:</p>
  
  <pre><code>    [HttpPost, ActionName("Delete")]
      [ValidateAntiForgeryToken]
      public ActionResult DeleteConfirmed(int id)
      {
          // i've edited this code, i think the problem lies in this code bellow
          // start edited code
          ms_student ms_student = db.ms_student
               .Include(i =&gt; i.ms_person) 
               .Include(i =&gt; i.ms_person.ms_user)
               .Where(i =&gt; i.user_id_student == id)
               .Single(); 
          // end edited code
  
          db.ms_student.Remove(ms_student);
          db.SaveChanges();
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>this is my ms_user model:</p>
  
  <pre><code>namespace test.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class ms_user
      {
          public int ID { get; set; }
          public string password { get; set; }
          public string salt { get; set; }
          public Nullable&lt;int&gt; administrative_type_id { get; set; }
          public string email_login { get; set; }
  
          public virtual ms_person ms_person { get; set; }
      }
  }
  </code></pre>
  
  <p>this is ms_person model:</p>
  
  <pre><code>namespace test.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class ms_person
      {  
          public int ID { get; set; }
          public Nullable&lt;int&gt; family_id { get; set; }
          public string first_name { get; set; }
          public string last_name { get; set; }
          public string email { get; set; }
          public string address { get; set; }
          public string phone_address { get; set; }
          public string mobile_phone_number { get; set; }
          public string gender { get; set; }
          public Nullable&lt;System.DateTime&gt; date_of_bith { get; set; }
          public Nullable&lt;System.DateTime&gt; date_start { get; set; }
          public Nullable&lt;System.DateTime&gt; date_end { get; set; }
          public string status { get; set; }
          public string identification_ID { get; set; }
          public string passport { get; set; }
          public Nullable&lt;int&gt; user_type_id { get; set; }
          public string file_image { get; set; }
  
          public virtual ms_student ms_student { get; set; }
          public virtual ms_user ms_user { get; set; }
  
      }
  }
  </code></pre>
  
  <p>Lastly my ms_person model:</p>
  
  <pre><code>namespace test.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class ms_student
      {
          public int user_id_student { get; set; }
          public int student_code { get; set; }
          public int course_id { get; set; }
          public string degree { get; set; }
          public Nullable&lt;int&gt; current_semester { get; set; }
          public string cuti_session { get; set; }
  
          public virtual ms_person ms_person { get; set; }
      }
  }
  </code></pre>
  
  <p>just you know that the model code is auto generated, i'm using ado.net entity model and the only table/entity that deleted are only the ms_student table(sorry, i'm kinda confused with naming: model or entity or table) </p>
  
  <p>the ID on ms_person are auto increment PK
  the ID on ms_user actually the FK also the PK of ms_person
  and (foolishly of me for the different naming) user_id_student actually the FK also the PK of ms_person</p>
  
  <p>thank you very much</p>