asp.net mvc 3 - How to get Max(ID) from Student and Create in MVC -


i using 1 mvc example in id incremental in database. create record like: in case id in student table not incremental, need max(id) student table.

[httppost] [validateantiforgerytoken] public actionresult create([bind(include = "id,lastname,firstmidname,enrollmentdate,countryid,account_code")] student student) {     if (modelstate.isvalid)     {         db.students.add(student);         db.savechanges();         return redirecttoaction("index");     }     return view(student); } 

i want remove "id" include , want max(id) student table through linq , save table. please me thanks. me please


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -