Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
- <meta name="viewport" content="width=device-width" />
- </head>
- <body>
- @RenderBody()
- </body>
- @{
- Layout = "~/Layouts/_Root.cshtml";
- }
- @{
- Layout = "~/Layouts/_Root.cshtml";
- }
- public ActionResult Index(string id) {
- var product= repository.GetById(new Guid(id));
- if(product== null) {
- throw new HttpException(404, "Not Found");
- }
- var model = Mapper.Map<IProduct, ProductViewModel>(product);
- return View(model);
- }
- public ActionResult Index(string id) {
- var product= repository.GetById(new Guid(id));
- if(product== null) {
- throw new HttpException(404, "Not Found");
- }
- Viewbag.ProductType = product.productType;
- var model = Mapper.Map<IProduct, productViewModel>(product);
- return View(model);
- }
- @{
- Layout = "~/Layouts/_Root.cshtml";
- }
- @Viewbag.productType
- @model producttest.product.Web.ProductViewModel
- @{
- Layout = "~/Layouts/_productView.cshtml";
- ViewBag.Title = @Model.Name;
- }
- <h1>@Model.Name)</h1>
- <section>
- <h2>@Model.Description, @Model.Price</h2>
- <p>
- @Model.ImageUrl<br />
- </p>
- </section>
- Compiler Error Message: CS0103: The name 'ViewBag' does not exist in the current context
- Source Error:
- Row 3:
- Row 4: }
- Row 5: @ViewBag.productType;
- <body>
- @RenderBody()
- </body>
- @model MyProject.ViewModels.MyViewModel
- @Model.MyProperty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement