コード例 #1
0
ファイル: SurveyController.cs プロジェクト: tdalia/NetTechno
        public async Task <IActionResult> PostNewSurvey(SurveyViewModel survey)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            // Convert SurveyViewModel to Survey
            Survey surveyEnt = survey.ConvertToSurvey();
            bool   added     = await surveyContext.AddSurvey(surveyEnt);

            if (added)
            {
                return(CreatedAtAction("PostNewSurvey", "Survey Added Successfully"));
            }
            else
            {
                return(BadRequest("Error occured while saving the Survey."));
            }
        }
コード例 #2
0
 //SurveyDAL
 public void AddSurvey(surveys survey)
 {
     surveyDAL.AddSurvey(survey);
 }