Example #1
0
        public static Domain.Survey MapObject(this Models.SurveyModel model)
        {
            if (model == null)
            {
                return(null);
            }
            Domain.Survey result = new Domain.Survey();
            result.Id              = model.Id;
            result.Duration        = model.Duration;
            result.CreateDateTime  = model.CreateDateTime;
            result.Status          = model.Status;
            result.Questions       = model.Questions.Select(p => p.MapObject()).ToList();
            result.CreatorUserName = model.CreatorUserName;

            return(result);
        }
Example #2
0
        public static Models.SurveyModel MapObject(this SurveyResultDto survey)
        {
            if (survey == null || survey.Survey == null)
            {
                return(null);
            }
            var o = survey.Survey;

            Models.SurveyModel result = new Models.SurveyModel();
            result.Id              = o.Id;
            result.Duration        = o.Duration;
            result.CreateDateTime  = o.CreateDateTime;
            result.Status          = o.Status;
            result.Questions       = o.Questions.Select(p => p.MapObject()).ToList();
            result.UserAnswers     = o.UserAnswers.Select(p => p.MapObject()).ToList();
            result.CreatorUserName = o.CreatorUserName;
            result.ValidOperations = survey.ValidOperations;
            return(result);
        }