Ejemplo n.º 1
0
        public static PTExerciseProgress AddProgress(PTExerciseProgress progress)
        {
            try
            {
                //TODO: method not going to work without an exercise id
                using (PTLinkDatabaseDataContext db = new PTLinkDatabaseDataContext())
                {
                    ExerciseProgressXref dbProgress = new ExerciseProgressXref();
                    dbProgress.Timestamp = (long)progress.timestamp;
                    dbProgress.ExerciseId = progress.exerciseID;
                    dbProgress.ProgressId = progress.value;

                    db.ExerciseProgressXrefs.InsertOnSubmit(dbProgress);
                    db.SubmitChanges();
                    progress.ID = dbProgress.Id;
                }
                return progress;
            }
            catch
            {
                return null;
            }
        }
 partial void DeleteExerciseProgressXref(ExerciseProgressXref instance);
 partial void UpdateExerciseProgressXref(ExerciseProgressXref instance);
 partial void InsertExerciseProgressXref(ExerciseProgressXref instance);
		private void detach_ExerciseProgressXrefs(ExerciseProgressXref entity)
		{
			this.SendPropertyChanging();
			entity.Progress = null;
		}
		private void attach_ExerciseProgressXrefs(ExerciseProgressXref entity)
		{
			this.SendPropertyChanging();
			entity.Exercise = this;
		}