コード例 #1
0
        /// <summary>
        /// Builds a new SFAppViewModel object from the SFApp associated with user who owns 'email'
        /// </summary>
        /// <param name="email"> email of user whose app to prepare as SFAppViewModel </param>
        /// <returns> SFAppViewModel for user's current SFApp, or 'null' if no open SFApp exists </returns>
        public async Task <SFAppViewModel> BuildSFAppVM(string email)
        {
            SFApp appl = await GetSFAppAsync(email);

            if (appl != null)
            {
                SFAppViewModel sFApp = new SFAppViewModel();
                sFApp.Appl         = appl;
                sFApp.AppResponses = await _response.GetAllAppResponsesAsync(appl.ID);

                sFApp.Questions = await _question.GetAppQuestionsAsync(sFApp.AppResponses);

                sFApp.Categories = _question.GetAllCategories(sFApp.Questions);
                return(sFApp);
            }
            return(null);
        }