@model MrCMS.Web.Apps.Ecommerce.Pages.Product

<div id="category-list">
    @Html.LabelFor(product => product.Categories)
    @Html.ActionLink("Add", "AddCategory", "Product", new { id = Model.Id }, new { @class = "btn btn-primary btn-xs btn-default", data_toggle = "fb-modal" })
    
    @if (Model.Categories.Any())
    {
        <table class="table table-striped table-condensed">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var category in Model.Categories)
                {
                    <tr>
                        <td>@category.NestedName</td>
                        <td>@Html.ActionLink("Remove", "RemoveCategory", "Product", new {id = Model.Id, categoryId = category.Id}, new {@class = "btn btn-danger btn-xs btn-default", data_toggle = "fb-modal"})</td>
                    </tr>
                }
            </tbody>
        </table>
    }
    else
    {
        @:<p>Please click add to add a category.</p>
    }
</div>
