asp.net mvc 3 - Orchard CMS rendering parts outside of admin section -


i working on module following instructions here http://orchardproject.net/docs/creating-a-module-with-a-simple-text-editor.ashx

the 1 change want is, rendering product creation outside of admin module. created homecontroller this

public class homecontroller : controller {      public homecontroller(icontentmanager cm) {         contentmanager = cm;     }      private icontentmanager contentmanager { get; set; }     public actionresult index() {         return content("this index");      }        [themed]     public actionresult create()     {         var product = contentmanager.new("product");         var model = contentmanager.buildeditor(product);         return view((object) model);      } 

and file routes.cs in root folder

public class routes : irouteprovider {     public void getroutes(icollection<routedescriptor> routes)     {         foreach (var routedescriptor in getroutes())             routes.add(routedescriptor);     }      public ienumerable<routedescriptor> getroutes()     {         return new[] {             new routedescriptor {                 priority = 5,                 route = new route(                     "commerce",                     new routevaluedictionary {                         {"area", "simplecommerce"},                         {"controller", "home"},                         {"action", "index"}                     },                     new routevaluedictionary(),                     new routevaluedictionary {                         {"area", "simplecommerce"}                     },                     new mvcroutehandler())             },             new routedescriptor {                 priority = 6,                 route = new route(                     "commerce/create",                     new routevaluedictionary {                         {"area", "simplecommerce"},                         {"controller", "home"},                         {"action", "create"}                     },                     new routevaluedictionary(),                     new routevaluedictionary {                         {"area", "simplecommerce"}                     },                     new mvcroutehandler())             }          };     } } 

so how should move here onwards render whole thing when navigate url http://localhost:35713/commerce/create

but throws error saying create view didnt find. created view (create.cshtml) in views/home folder

@model simplecommerce.models.productpart <fieldset>     <label class="sub" for="sku">@t("sku")</label><br />     @html.textboxfor(m => m.sku, new { @class = "text" })<br />     <label class="sub" for="price">@t("price")</label><br />     @html.textboxfor(m => m.price, new { @class = "text" }) </fieldset> 

now throws error saying

the model item passed dictionary of type 'ishapeproxyedcfa08c61cf49898dc2e77bde025039', dictionary requires model item of type 'simplecommerce.models.productpart'.

oh, that's cross-posted. buildeditor creating shape, , template expecting strongly-typed model. dropping @model directive should substitute problem (which won't able use lambda-based helpers shapes.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -