Q:

FK constraint with ViewModel MVC4

I have a little problem using MVC4 and Entity Framework. I have an entity "Person" which is composed of an other entity named "ProductPackageCategories". I have also a ViewModel "PersonViewModel". In the "Create Person" view, I can create my new person and specify the category with a dropdownlist component. Usually, when I click on the submit button, the data are stored in the database. In my case, I retrieve all the data but not the ProductPackageCategory Id. Does anybody have an idea about this problem?
The Exception Message : 
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_bm_Persons_bm_ProductPackageCategories". The conflict occurred in database "C:\USERS\MAARAB\DESKTOP\PROJECT\2013-03-01_4-9_MA-OS_BUSI MATERIAL PROJECT\BUSIMATERIAL\BUSIMATERIAL\APP_DATA\BUSIMATERIAL.MDF", table "dbo.bm_ProductPackageCategories", column 'Id_ProductPackageCategory'.

The statement has been terminated.
My Create Actions in PersonController : 
public ActionResult Create()
        {
            ViewBag.Id_ProductPackageCategory = new SelectList(db.ProductPackageCategories, "Id_ProductPackageCategory", "Name");
            return View();
        }

        //
        // POST: /Person/Create

        [HttpPost]
        public ActionResult Create(PersonViewModel personViewModel)
        {

            if (ModelState.IsValid)
            {

                db.Persons.AddObject(personViewModel.person);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.Id_ProductPackageCategory = new SelectList(db.ProductPackageCategories, "Id_ProductPackageCategory", "Name", personViewModel.person.Id_ProductPackageCategory);

            return View(personViewModel);
        }

My ViewModel : 
public class PersonViewModel
{
    public Person person { get; set; }

    public PersonViewModel()
    {
        person = new Person();
    }

    public PersonViewModel(Person person)
    {
        this.person = person;
    }

}

My Create View : 
@model BuSIMaterial.Models.PersonViewModel

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Person</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.FirstName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.FirstName)
            @Html.ValidationMessageFor(model => model.person.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.LastName)
            @Html.ValidationMessageFor(model => model.person.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.NumNat)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.NumNat)
            @Html.ValidationMessageFor(model => model.person.NumNat)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.StartDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.StartDate)
            @Html.ValidationMessageFor(model => model.person.StartDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.EndDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.EndDate)
            @Html.ValidationMessageFor(model => model.person.EndDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.Upgrade)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.Upgrade)
            @Html.ValidationMessageFor(model => model.person.Upgrade)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.Id_ProductPackageCategory, "Category")
        </div>
        <div class="editor-field">
            @Html.DropDownList("Id_ProductPackageCategory", "Choose one...")
            @Html.ValidationMessageFor(model => model.person.Id_ProductPackageCategory)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.person.HouseToWorkKilometers)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.person.HouseToWorkKilometers)
            @Html.ValidationMessageFor(model => model.person.HouseToWorkKilometers)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

A:

Replace:
@Html.DropDownList("Id_ProductPackageCategory", "Choose one...")

with:
@Html.DropDownListFor(
    model => model.person.Id_ProductPackageCategory,
    (SelectList)ViewBag.Id_ProductPackageCategory,
    "Choose one..."
)

so that the person.Id_ProductPackageCategory property on your model is correctly bound from the selected value in the dropdown when the form is submitted to your HttpPost action.

