Example #1
0
 /// <summary>
 /// Creates survey
 /// </summary>
 /// <param name="surveyContext">Param with survey, questions, and options records</param>
 /// <returns>
 ///     Errors.OK survey created
 ///     Errors.SURVEY_ALREADY_EXIST if survey already exist
 ///     Errors.DATA_BASE_ERROR if an database exception was thrown
 /// </returns>
 public Errors CreateSurvey(CreateSurveyRequest surveyContext)
 {
     try
     {
         if (_dbManager.InsertSurvey(surveyContext.Name, surveyContext.Description, surveyContext.Questions))
         {
             return(Errors.OK);
         }
         else
         {
             return(Errors.SURVEY_ALREADY_EXIST);
         }
     }
     catch (Exception ex)
     {
         _logger.Error(ex.Message);
         return(Errors.DATA_BASE_ERROR);
     }
 }