Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
  6. <meta name="viewport" content="width=device-width" />
  7. </head>
  8. <body>
  9. @RenderBody()
  10. </body>
  11.  
  12. @{
  13. Layout = "~/Layouts/_Root.cshtml";
  14. }
  15.  
  16. @{
  17. Layout = "~/Layouts/_Root.cshtml";
  18. }
  19.  
  20. public ActionResult Index(string id) {
  21. var product= repository.GetById(new Guid(id));
  22.  
  23. if(product== null) {
  24. throw new HttpException(404, "Not Found");
  25. }
  26.  
  27. var model = Mapper.Map<IProduct, ProductViewModel>(product);
  28.  
  29. return View(model);
  30. }
  31.  
  32. public ActionResult Index(string id) {
  33. var product= repository.GetById(new Guid(id));
  34.  
  35. if(product== null) {
  36. throw new HttpException(404, "Not Found");
  37. }
  38. Viewbag.ProductType = product.productType;
  39.  
  40. var model = Mapper.Map<IProduct, productViewModel>(product);
  41.  
  42. return View(model);
  43. }
  44.  
  45. @{
  46. Layout = "~/Layouts/_Root.cshtml";
  47. }
  48. @Viewbag.productType
  49.  
  50. @model producttest.product.Web.ProductViewModel
  51.  
  52. @{
  53. Layout = "~/Layouts/_productView.cshtml";
  54. ViewBag.Title = @Model.Name;
  55.  
  56. }
  57.  
  58.  
  59. <h1>@Model.Name)</h1>
  60. <section>
  61. <h2>@Model.Description, @Model.Price</h2>
  62. <p>
  63. @Model.ImageUrl<br />
  64. </p>
  65. </section>
  66.  
  67. Compiler Error Message: CS0103: The name 'ViewBag' does not exist in the current context
  68.  
  69. Source Error:
  70.  
  71. Row 3:
  72. Row 4: }
  73. Row 5: @ViewBag.productType;
  74.  
  75. <body>
  76. @RenderBody()
  77. </body>
  78.  
  79. @model MyProject.ViewModels.MyViewModel
  80.  
  81. @Model.MyProperty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement