My create-controller not updating db, with dropdownlist and foreign keys

Atomic

New Member
I'm using no modelview or repository, following a tutorial i found on asp.netThe dropdownlist works fine, but when I hit create, the if (ModelState.IsValid) fails and returns me to the create screen, with no error. Any help would be greatly appreciated.View:\[code\]@Html.DropDownList("parentGenre", ViewBag.genreId as SelectList)\[/code\]create controller:\[code\]ViewBag.genreId = new SelectList(db.Genres, "genreId", "genreName");\[/code\]part of the movie table:\[code\]public virtual Genres parentGenre { get; set; }\[/code\]part of the genre table:\[code\][Key]public int genreId { get; set; }[StringLength(25)]public String genreName { get; set; }public ICollection<Movies> movies { get; set; }\[/code\]
 
Back
Top