The following tutorial demonstrates how to create a simple MVC Books widget with Feather. You leverage the attribute routing of MVC 5 and the Feather UI framework in the context of a Sitefinity CMS widget. The Books widget displays a list of books on the frontend and tracks on the client the points retrieved for each book.
Feather makes it possible to have MVC widgets that are stored in separate assemblies. The following sample creates the Books widget in a separate assembly.
Perform the following:
In the MVC/Models folder, create a new class named Book. The class needs to have:
The Book class should look similar to the following:
Next, in the MVC/Models folder, you create a new class named BooksViewModel. The class needs to have the following properties:
The BooksViewModel class should look similar to the following:
Use the following code sample:
You need to create an Index view, because this is the only view that is used by the BooksController. To do this, you must create a new Razor view named Index and to place it in the MVC/Views/Books folder.
To create the Index view, use the following code:
NOTE: You can create a Razor view in a class library project by selecting HTML Page from the Add New Item dialog, and then renaming the file extension to .cshtml. In the file properties, set the view as Embedded Resource.
NOTE: Be sure to mark the script as an Embedded Resource in the file properties.
You can now build the project and test the result by placing the Books widget on a page.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2020 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity