Ejemplo n.º 1
0
        private async void AddSurveyAsync()
        {
            if (!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Description) && !string.IsNullOrEmpty(LowUpperBound) && !string.IsNullOrEmpty(MidUpperBound))
            {
                var survey = await SurveyRepository.AddSurvey(new Survey
                {
                    Name          = Name,
                    Description   = Description,
                    CreatedOn     = DateTime.Now,
                    SurveyStatus  = SurveyStatus.Pending,
                    LowUpperBound = double.Parse(LowUpperBound),
                    MidUpperBound = double.Parse(MidUpperBound)
                });

                if (survey != null)
                {
                    Name          = string.Empty;
                    Description   = string.Empty;
                    LowUpperBound = string.Empty;
                    MidUpperBound = string.Empty;
                    await SweetAlertMessage.SuccessMessage();
                }
                else
                {
                    await SweetAlertMessage.ErrorMessage();
                }
            }
            else
            {
                await SweetAlertMessage.ErrorMessage();
            }
        }
Ejemplo n.º 2
0
        public ActionResult AddSurvey(CreateSurveyRequest createRequest)
        {
            var newSurvey = _surveyRepository.AddSurvey(createRequest.Date);

            foreach (var question in createRequest.Questions)
            {
                Console.WriteLine(question);
            }
            //_questionRepository.AddQuestion(createRequest.Questions);
            return(Created($"/api/student/{newSurvey.Id}", newSurvey));
        }