Пример #1
0
        public ActionResult ViewLog(int id)
        {
            Job job;
            using (var repo = new JobRepository())
            {
                job = repo.GetJobById(id);
            }

            if (job == null)
            {
                return Content("Job not found.");
            }

            string logFileName = "Deploy_" + job.Name + "_" + job.Id + ".log";

            string logFile = Path.Combine(_logDirectory, logFileName);
            if (System.IO.File.Exists(logFile))
            {
                string allText = System.IO.File.ReadAllText(logFile);
                var viewModel = new DeploymentLogViewModel
                    {
                        JobId = job.Id.ToString(),
                        DeploymentLog = allText,
                        LogName = job.Name
                    };

                return View(viewModel);
            }

            return Content("File not found.");
        }
Пример #2
0
        public ActionResult ViewLog(int id)
        {
            Job job;

            using (var repo = new JobRepository())
            {
                job = repo.GetJobById(id);
            }

            if (job == null)
            {
                return(Content("Job not found."));
            }

            string logFileName = "Deploy_" + job.Name + "_" + job.Id + ".log";

            string logFile = Path.Combine(_logDirectory, logFileName);

            if (System.IO.File.Exists(logFile))
            {
                string allText   = System.IO.File.ReadAllText(logFile);
                var    viewModel = new DeploymentLogViewModel
                {
                    JobId         = job.Id.ToString(),
                    DeploymentLog = allText,
                    LogName       = job.Name
                };

                return(View(viewModel));
            }


            return(Content("File not found."));
        }