// GET: Document/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ExistingProduct existingProduct = db.ExistingProducts.Find(id); if (existingProduct == null) { return(HttpNotFound()); } db.Entry(existingProduct).Reference(e => e.Product).Load(); db.Entry(existingProduct.Product).Reference(p => p.Company).Load(); var vm = DocumentViewModel.CreateViewModel(existingProduct); ViewBag.QR_URL = Url.Content("~/api/QR/" + id); //ViewBag.PlotURL = Url.Content("~/api/Plot?CompanyId=" + id); return(View(vm)); }