EntityFramework ForeignKey via Id snippet From dropdown combobox parse
public virtual Staff AssignedTo { get; set; }
[ForeignKey("AssignedTo")]
public int AssignedToId { get; set; }
public void SetAssignedTo(string id)
{
if (int.TryParse(id, out int i)) AssignedToId = i;
}