Example #1
0
        public bool AddAssignment(Assignment dataToAdd, out int id)
        {
            dataToAdd.Description = dataToAdd.Description ?? "";
            dataToAdd.CreatedOn   = DateTime.Now;
            dataToAdd.IsActive    = true;

            bool fileCopied = true;

            if (!String.IsNullOrEmpty(dataToAdd.AssignmentAsset) && (fileCopied = UtilityFunctions.CopyFile(dataToAdd.AssignmentAsset, LearningAssetsPath.TempFile, LearningAssetsPath.Assignment)))
            {
                UtilityFunctions.DeleteFile(dataToAdd.AssignmentAsset, LearningAssetsPath.TempFile);
            }

            return(LearningPathDataAccessor.AddAssignment(dataToAdd, out id) && fileCopied);
        }