Link to home
Start Free TrialLog in
Avatar of ttist25
ttist25

asked on

MVC CRUD in VB.NET - Edit not saving

Hello there,

I'm working on an MVC vb.net app and I'm trying to do my first CRUD implementation.  I've got the List and details pieces working fine but Edit is giving me some trouble.  I'm working from the tutorial here but it's in C# and i'm trying to convert it to VB.NET

Anyway, when I click the Edit link in my list view, it brings up the correct record and the correct information in the fields, but when I change it and click save I get oops.  

       <HttpPost> _
        Function Edit(ByVal id As Integer, ByVal collection As FormCollection) As ActionResult
            Try
                ' TODO: Add update logic here
                Dim v As People_t = db.People_ts.Single(Function(vh) vh.People_ID = id)

                v.LastName = Integer.Parse(collection("LastName"))

                v.FirstName = Integer.Parse(collection("FirstName"))

                v.Discipline_ID = Integer.Parse(collection("Discipline_ID"))

                db.SubmitChanges()

                Return RedirectToAction("Index")
            Catch
                Return View("oops")
            End Try
        End Function

Open in new window


Any ideas where I've gone wrong?

TIA!
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ttist25
ttist25

ASKER

You're the man.