public async Task <PlayList> GetPlayList <T>(string token, string method, string?id)
        {
            PlayListResponse playListResponse = new PlayListResponse();
            string           request          = "";

            if (id != null)
            {
                request = JsonConvert.SerializeObject(GetFilteredParamIdRequestJSON("5", method, id));
            }
            else
            {
                request = JsonConvert.SerializeObject(GetFilteredApiRequestJSON("5", method));
            }

            var    playList    = new PlayList();
            string apiResponse = await CallFilteredApi <T>(request, token);

            try
            {
                playListResponse = JsonConvert.DeserializeObject <PlayListResponse>(apiResponse);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            if (playListResponse.Result != null)
            {
                try
                {
                    playList = PopulateLearningAssetsForPlayList(playListResponse.Result);

                    var i = 0;
                    while (playList.LearningAssets.Count() > 0 && i < playList.LearningAssets.Count())
                    {
                        LearningAsset learningAsset = playList.LearningAssets[i];
                        if (learningAsset.Completed)
                        {
                            playList.LearningAssets.Remove(learningAsset);
                        }
                        i++;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            if (playList.Id == "")
            {
                playList.Id = "1";
            }
            return(playList);
        }
Пример #2
0
 public void LogAssetLaunch(int candidateId, int selfAssessmentId, LearningAsset learningAsset)
 {
     connection.Execute(
         "UpdateFilteredLearningActivity",
         new
     {
         FilteredAssetID = learningAsset.Id,
         learningAsset.Title,
         learningAsset.Description,
         learningAsset.DirectUrl,
         Type             = learningAsset.TypeLabel,
         Provider         = learningAsset.Provider.Name,
         Duration         = learningAsset.LengthSeconds,
         ActualDuration   = learningAsset.LengthSeconds,
         CandidateId      = candidateId,
         SelfAssessmentID = selfAssessmentId,
         learningAsset.Completed,
         Outcome  = learningAsset.CompletedStatus,
         Bookmark = learningAsset.IsFavourite,
     },
         commandType: CommandType.StoredProcedure
         );
 }
Пример #3
0
 public void LogAssetLaunch(int candidateId, int selfAssessmentId, LearningAsset learningAsset)
 {
     selfAssessmentDataService.LogAssetLaunch(candidateId, selfAssessmentId, learningAsset);
 }