private void btnSaveWitness_Click(object sender, RoutedEventArgs e) { using (DataController context = new DataController()) { DefendantViewModel defendant = new DefendantViewModel(); defendant.DefendantModel.FirstName = txtFName.Text; defendant.DefendantModel.MiddleName = txtMName.Text; defendant.DefendantModel.LastName = txtLName.Text; defendant.DefendantModel.NameSuffix = txtSuffix.Text; defendant.DefendantModel.Race = cboRace.SelectedValue.ToString(); defendant.DefendantModel.Sex = cboSex.SelectedValue.ToString(); context.CreateWitness(defendant); }
public class DefendantModel { public int ID { get; set; } public string FirstName { get; set; } public string MiddleName { get; set; } public string LastName { get; set; } public string NameSuffix { get; set; } public string Alias { get; set; } public string SSN { get; set; } public string Race { get; set; } public string Sex { get; set; } public List<WitnessModel> WitnessModelList { get; set; } public WitnessModel WitnessModel { get; set; } }
public class WitnessModel { public int ID { get; set; } public int MasterID { get; set; } public string FirstName { get; set; } public string MiddleName { get; set; } public string LastName { get; set; } public string NameSuffix { get; set; } public string Sex { get; set; } public string Race { get; set; } }