Beispiel #1
0
        public JsonResult History(int fileId)
        {
            List <FileVersionModel> fileVersions = new List <FileVersionModel>();
            ImplementationGuideFile file         = this.tdb.ImplementationGuideFiles.Single(y => y.Id == fileId);

            if (!CheckPoint.Instance.GrantViewImplementationGuide(file.ImplementationGuideId))
            {
                throw new AuthorizationException("You do not have access to view this implementation guide's files.");
            }

            foreach (var version in file.Versions.OrderByDescending(y => y.UpdatedDate))
            {
                FileVersionModel newFileVersionModel = new FileVersionModel()
                {
                    FileId    = fileId,
                    VersionId = version.Id,
                    Date      = version.UpdatedDate.ToString("MM/dd/yyyy HH:mm:ss"),
                    Note      = version.Note
                };

                fileVersions.Add(newFileVersionModel);
            }

            return(Json(fileVersions, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 public void FileSeparator()
 {
     foreach (var file in scriptFiles)
     {
         FileVersionModel fileContent = new FileVersionModel();
         fileContent.Path    = file;
         fileContent.Name    = Path.GetFileNameWithoutExtension(file);
         fileContent.Version = GetVersionNumberFromVersionName(fileContent.Name);
         fileContent.IsUp    = GetUpOrDown(fileContent.Name);
         fileVersions.Add(fileContent);
     }
 }
Beispiel #3
0
        public void FileVersionModelTest()
        {
            FileVersionModel fileVersionModel = new FileVersionModel()
            {
                Editor   = "Editor",
                Modified = "Modified",
                Name     = "Name",
                Rev      = "Rev",
                Size     = "Size",
            };
            var Editor   = fileVersionModel.Editor;
            var Modified = fileVersionModel.Modified;
            var Name     = fileVersionModel.Name;
            var Rev      = fileVersionModel.Rev;
            var Size     = fileVersionModel.Size;

            Assert.IsTrue(Editor == "Editor");
            Assert.IsTrue(Modified == "Modified");
            Assert.IsTrue(Name == "Name");
            Assert.IsTrue(Rev == "Rev");
            Assert.IsTrue(Size == "Size");
        }