public ActionResult SurveyQuestion(List <QuestionViewModel> list)
        {
            surveyEntities     entity      = new surveyEntities();
            List <AnswerTable> objectTable = new List <AnswerTable>();

            try
            {
                foreach (var questionData in list)
                {
                    AnswerTable obj = new AnswerTable();
                    obj.Question_ID    = questionData.Question_ID;
                    obj.SelectedAnswer = questionData.SelectedAnswer;
                    obj.User_ID        = 1027;
                    obj.Survey_ID      = 1;
                    objectTable.Add(obj);
                }
            }
            catch
            {
                return(View(list));
            }
            foreach (var item in objectTable)
            {
                entity.AnswerTables.Add(item);
                entity.SaveChanges();
            }
            return(View());
        }
 public ActionResult Signup(Registration registrationModel)
 {
     using (var context = new surveyEntities())
     {
         context.Registrations.Add(registrationModel);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }
 public ActionResult AddSurvey(AddSurveyViewModel addSurveyView)
 {
     using (var context = new surveyEntities())
     {
         SurveyTable surveyTable = new SurveyTable();
         surveyTable.Survey_Type = addSurveyView.Survey_Type;
         context.SurveyTables.Add(surveyTable);
         context.SaveChanges();
     }
     return(RedirectToAction("AddSurvey"));
 }
 public ActionResult AddQuestion(AddQuestionViewModel addQuestionViewModel)
 {
     using (var context = new surveyEntities())
     {
         QuestionTable questionTable = new QuestionTable();
         questionTable.Question  = addQuestionViewModel.Question;
         questionTable.Survey_ID = addQuestionViewModel.Survey_ID;
         context.QuestionTables.Add(questionTable);
         context.SaveChanges();
     }
     return(View());
 }