ASP.Net MVC multi record save -


i'm writing mvc5 application have model called survey.

 public class survey {     public int surveyid { get; set; }      [required]     public string description { get; set; }      [required]     public string classification { get; set; }       [required]     public int score1{ get; set; }       [required]     public int score2{ get; set; }      public string notes { get; set; } } 

i'm passing collection of survey records view display them in list. want able allow user answer each survey record/question , have save button @ bottom of form conduct 1 post action controller.

i've never tried pass collection of objects post controller i'm curious if approach? suggestions appreciated!

thanks in advance!

what suggest not passing collection view new viewmodel 'surveyset' perhaps field being ilist(survey). in controller when call db.savechanges() on surveyset , changes each of surveys should saved.

[httppost] [validateantiforgerytoken] public actionresult createcomment(surveyset surveyset) { db.entry(surveyset).state = entitystate.modified; db.savechanges(); } 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -