示例#1
0
        public FileStreamResult Pdf(string id)
        {
            if (id == null)
            {
                RedirectToAction("Index", "Error");
            }

            var pdf = new Bll.PdfWrapper.Pdf();

            Bll.Instruments instruments = null;
            if (id.ToLower() == "test")
            {
                instruments = new Bll.TestUnitHelper.Mock.InstrumentsMock().GetDemoInstruments();
            }
            else
            {
                var instrument = new Bll.Instrument();
                instruments = instrument.GetInstruments(id);
            }

            if (instruments == null)
            {
                RedirectToAction("Index", "Error");
            }

            byte[] byteInfo   = pdf.Get(instruments, true);
            var    workStream = new MemoryStream();

            workStream.Write(byteInfo, 0, byteInfo.Length);
            workStream.Position = 0;

            return(new FileStreamResult(workStream, "application/pdf"));
        }
示例#2
0
        public ActionResult Plan(string id)
        {
            Instruments instruments = null;

            if (id == "test")
            {
                instruments = new Bll.TestUnitHelper.Mock.InstrumentsMock().GetDemoInstruments();
            }
            else
            {
                var instrument = new Bll.Instrument();
                instruments = instrument.GetInstruments(id);
            }

            if (instruments == null)
            {
                instruments = new Instruments();
                return(RedirectToAction("MissingPlan"));
            }

            var model = new Models.PlanViewModel(instruments, id);

            return(View(model));
        }