private async Task <StudentLearningEventLog> MapToStudentLearningEventLog( LearningActivityEventModel model, Persistence.Models.LearningApp learningApp) { if (null == learningApp) { return(null); } // Map model to entity var entity = new StudentLearningEventLog { StudentElectronicMailAddress = model.IdentityElectronicMailAddress, LeaningAppUrl = model.LeaningAppUrl, UTCStartDate = model.UTCStartDateTime, UTCEndDate = model.UTCEndDateTime, LearningAppIdentifier = learningApp.LearningAppIdentifier // TODO: Add other properties as needed. }; await setStudentIds(entity); if (model.UTCEndDateTime != null) { entity.TimeSpent = (int?)(entity.UTCEndDate.Value - entity.UTCStartDate).TotalSeconds; } return(entity); }
public async Task SaveLearningActivityEventAsync(LearningActivityEventModel model) { var learningApp = await _learningAppQueries.GetWhitelistedApp(model.LeaningAppUrl); StudentLearningEventLog entity = await MapToStudentLearningEventLog(model, learningApp); await _studentLearningEventLogCommands.AddAsync(entity); }