예제 #1
0
        public async void _SaveAnswerQuestionComplete(String _model, string Idtask)
        {
            int resp              = 0;
            var _task             = JSonConvertUtil.Deserialize <MyTaskViewModel>(_model);
            var _questionModel    = new List <MyTaskQuestionsViewModel>();
            var _questionModelSub = new List <MyTaskQuestionsViewModel>();

            foreach (var _question in _task.ServiceCollection.First().ServiceDetailCollection)
            {
                _questionModel.AddRange(_question.QuestionCollection.Where(x => x.CodeTypePoll == "COMPLETE"));
            }
            foreach (var _question in _task.ServiceCollection.First().ServiceDetailCollection)
            {
                foreach (var _seccion in _question.Sections)
                {
                    _questionModelSub.AddRange(_seccion.QuestionCollection.Where(x => x.CodeTypePoll == "COMPLETE"));
                }
            }

            var _union = ((from a in _questionModel select a)
                          .Union
                              (from a in _questionModelSub select a)).ToList();

            if (_union.Count() > 0)
            {
                _taskCampaignBusiness.CreateAnswerComplete(_union, Guid.Parse(Idtask), ApplicationUserCurrent.AccountId, Guid.Parse(ApplicationUserCurrent.UserId));
            }
        }