示例#1
0
        public ActionResult Share(string id, string key)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(HttpNotFound());
            }
            if (string.IsNullOrEmpty(key))
            {
                return(HttpNotFound());
            }

            var project = _projectRepository.Find(id);

            if (project == null)
            {
                return(HttpNotFound());
            }

            if (project.SecurityKey != key)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            var creator = new DocumentCreator();
            var buffer  = creator.CreatePdf(project);

            return(File(buffer, "application/pdf", project.Name + ".pdf"));
        }
        public void CreatePdf()
        {
            var project = ProjectFactory.Create();
            var creator = new DocumentCreator();

            string file = string.Format("Test-{0}.pdf", DateTime.Now.Ticks);
            creator.CreatePdf(project, file);
        }
示例#3
0
        public void CreatePdf()
        {
            var project = ProjectFactory.Create();
            var creator = new DocumentCreator();

            string file = string.Format("Test-{0}.pdf", DateTime.Now.Ticks);

            creator.CreatePdf(project, file);
        }
示例#4
0
        public ActionResult Report(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(HttpNotFound());
            }

            Project project;

            if (!HasAccess(id, out project))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }

            if (project == null)
            {
                return(HttpNotFound());
            }

            var creator = new DocumentCreator();
            var buffer  = creator.CreatePdf(project);

            return(File(buffer, "application/pdf", project.Name + ".pdf"));
        }