Display external db values in Umbraco solution. both as Partial view and as a Umbraco page.
Hi,
I am implementing a umbraco site which has to display category and its product from the another mvc solution. I have taken the values from mvc project
Using SurfaceController I have taken the category names and displayed as Partial View (not sure if it is correct).
Now If i click the particular category it should load a list of products under it. Here I am getting error like "Cannot bind source type Seab.Umbraco.Model.CategoryDetailModel to model type Umbraco.Web.Models.RenderModel."
umbraco template page(hometemplate.cshtml)
hometemplate.cshtml code :
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
...
some code for the template elements
...
@Html.Action("CategoryMenu", "CategoryMenuSurface")
CategoryMenu.cshtml code:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Seab.Umbraco.Model.ParentCategoryModel>
@{
foreach (var category in Model.ParentCategoryList)
{
<div class="col-xs-6 col-md-4 col-lg-4 levelone">
<div class="oddmenu">
@Url.Action("Index", "CategoryMenuSurface", new { id = category.Id })
</div>
</div>
}
}
public class CategoryMenuSurfaceController : SurfaceController
{
public ActionResult CategoryMenu()
{
CategoryViewModelRepository categoryRepo = new CategoryViewModelRepository();
var model = new ParentCategoryModel();
model.ParentCategoryList = categoryRepo.GetParentCategoryList();
return PartialView("CategoryMenu",model);
}
public ActionResult Index(int id)
{
CategoryViewModelRepository categoryRepo = new CategoryViewModelRepository();
var model = new CategoryDetailModel();
var category = categoryRepo.GetCategoryById(id);
if (category != null)
{
model.Id = category.Id;
model.Name = category.ParentName;
}
return PartialView("CategoryDetails", model);
}
}
if someone give some sample code it would be great.
Display external db values in Umbraco solution. both as Partial view and as a Umbraco page.
Hi,
I am implementing a umbraco site which has to display category and its product from the another mvc solution. I have taken the values from mvc project
Using SurfaceController I have taken the category names and displayed as Partial View (not sure if it is correct).
Now If i click the particular category it should load a list of products under it. Here I am getting error like "Cannot bind source type Seab.Umbraco.Model.CategoryDetailModel to model type Umbraco.Web.Models.RenderModel."
umbraco template page(hometemplate.cshtml)
hometemplate.cshtml code :
CategoryMenu.cshtml code:
categoryDetails.cshtml code :
MyController code :
if someone give some sample code it would be great.
is working on a reply...