Q:

Using Html.DropDownListFor to list data from one table, but save it to another

On the Create action, I can add information into editor fields and save them to Table1, however, for one of the fields I want a drop down list, populated from a column from Table2, which can then be selected and saved to Table1 in one of the fields, depending on selection. I have managed to display the information in a drop down table from Table2, but not pass it to Table1
Model1:
public int id { get; set; }
    public string JobNo { get; set; }
    public string DelNo { get; set; }
    public Nullable<int> DeptToPack { get; set; }
    public string PackNo { get; set; }
    public Nullable<decimal> TargetHrs { get; set; }
    public Nullable<System.DateTime> PackingDate { get; set; } 
    public virtual Table2 Table2{ get; set; }

Model 2:
public Table2()
{
    this.Table1= new HashSet<Table1>();
}

public int id { get; set; }
public string Dept { get; set; }
public virtual ICollection<Table1> Table1{ get; set; }

Combined Model:
public class Combined
    {
        public Table1 Table1 { get; set; }
        public Table2 Table2{ get; set; }
     }

The view currently displays text editors for all the fields which can be edited and saved to a database using SaveChanges(); on the HomeController, under a Create action
Create Action
public ActionResult Create()
        {

            IEnumerable<SelectListItem> items = _db.Table2
                .Select(c => new SelectListItem
                {
                    Value = c.Dept,
                    Text = c.Dept
                });

            ViewBag.Dropdownlist = items;

            return View();
        }

        [HttpPost]
        public ActionResult Create(Table1 table1)
        {
            if (ModelState.IsValid)
            {
                _db.Table1.Add(table1);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(table1);
        }

And the view displays the information from table1, and one field from table2. I seem to be having trouble with the @Html.DropDownList element
I currently have (below) which displays the data, but cannot be processed to Table1
 @Html.DropDownList("Table1.Field1", (IEnumerable<SelectListItem>) ViewBag.DropDownList)

Hopefully the image explains it better, filled input boxes will be saved to Table1
except for 1 field, which is a drop down list from column {InfoToPass}, from Table2, in which 1 of 4 options can be selected, then that value along with all the other inputs will be saved to Table1

A:

My scenario involved joining a few tables to provide a certain column value, (so you can ignore then linq query), which would displayed in a drop down list. The user can then select the values (if any) from the drop down list which can then be saved to another table (Table1).
Create View:
    @model TharInfo2.Models.Combined

    <div class="editor-field">
    @Html.DropDownListFor(model => model.Table1.DelNo, (IEnumerable<SelectListItem>)ViewBag.Rev)
    </div>

Create Controller:
        public ActionResult Create()
            {
            var rd = RouteData.Values["jobno"];
            var query = (from t in _db.table3
                         join d in _db.table2 on t.delivery_number equals d.ID
                         join m in _db.table4 on d.OrderNo equals m.JobNo
                         where m.JobNo == rd
                         select new
                              {
                                  t.rev_delivery_number
                              });

             IEnumerable<SelectListItem> rev_del = query
                        .Select(c => new SelectListItem
                        {
                            Value = c.rev_delivery_number,
                            Text = c.rev_delivery_number
                        });

             ViewBag.Rev = rev_del;

             return View();
             }

                [HttpPost]
                public ActionResult Create(Table1 table1)
                {

                    if (ModelState.IsValid)
                    {
                        _db.Table1.Add(table1);
                        _db.SaveChanges();
                        return RedirectPermanent("Index");

                    }

                    return View(table1);
                }

