Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass a model to a Razor view from Nancy

Tags:

razor

nancy

I have Razor woking with Nancy, but can't figure out how to make the view see the model.

I am rending the model with this code (where t is the model instance).

  return View[ "views/addshortcut.cshtml", t ];

How can I make the Razor see t?

like image 862
rp. Avatar asked Apr 05 '12 17:04

rp.


1 Answers

The model is there, just start using it. If you are talking about intellisense then you can use the @inherit statement in razor.. something like

@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<YourNameSpace.YourModel>
like image 132
TheCodeJunkie Avatar answered Dec 08 '22 06:12

TheCodeJunkie