Example #1
0
 public IActionResult Post([FromBody] SurveyModel surveyModel)
 {
     if (surveyModel == null)
     {
         return(BadRequest());
     }
     TryValidateModel(surveyModel);
     if (this.ModelState.IsValid)
     {
         var survey = _surveysService.Create(surveyModel);
         return(CreatedAtRoute("GetSurvey", new { controller = "Surveys", id = survey.Id }, survey));
     }
     else
     {
         return(BadRequest());
     }
 }
Example #2
0
        public async Task <IActionResult> Post(NewSurveyDto newSurvey)
        {
            var createdSurvey = await _surveysService.Create(newSurvey);

            return(Ok(createdSurvey));
        }
 public async Task <OperationResult> Create([FromBody] SurveyConfigCreateModel createModel)
 {
     return(await _surveysService.Create(createModel));
 }