コード例 #1
0
        public ExportGridRow GetExportableTest(Guid testResultId)
        {
            var result = new ExportGridRow();

            try
            {
                var query = from tr in dbContext.TestResults
                            join hndlr in dbContext.Handlers on tr.Handler equals hndlr.Id
                            join dog in dbContext.Dogs on tr.Dog equals dog.Id
                            where tr.Id.Equals(testResultId)
                            select new ExportGridRow
                {
                    TestResultId = tr.Id,
                    HandlerName  = hndlr.FirstName + " " + hndlr.LastName,
                    DogName      = dog.Name,
                    TestDate     = tr.TestDate
                };

                result = query.FirstOrDefault() ?? new ExportGridRow();
            }
            catch (Exception oEx)
            {
                Debug.WriteLine($"Exception: {oEx.Message}");
            }

            return(result);
        }
コード例 #2
0
        // GET: ExportToPdf/Details/{Guid}
        public ActionResult Details(Guid TestResultId)
        {
            if (TestResultId == Guid.Empty)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ExportGridRow egr = exportServices.GetExportableTest(TestResultId);

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

            return(View(egr));
        }