Not sure how to word this...
I have a Model, here is a section of it:
public class AnswerSheet
{
public string Q1 { get; set; }
public string Q2 { get; set; }
public string Q3 { get; set; }
public string Q4 { get; set; }
I am using a Viewmodel to reuse the same view to answer each question separately. It is almost working. Is there any way I can use my controller as follows to dynamically assign the model.q#, ex:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateNextQ([Bind(Include = "ID, qCounter, Question,Comment")] AnswerSheetCreateVM answerVM)
{
if (ModelState.IsValid)
{
string questionAns = answerVM.Question + answerVM.Comment;
AnswerSheet answer= db.AnswerSheets.Find(answerVM.ID);
//THIS PART HERE IS WHERE I HAVE A PROBLEM
answer.Q(answerVM.qCounter) = questionAns;
//That one line above
db.AnswerSheets.Add(answer);
db.SaveChanges();
So basically can I get data from my controller variable (qCounter in this case) and assign it to my model like Model.Q(qcounter)
As a side note I am open to suggestion on how to word this question or what tags to assign to it.