I would create an MVC API and create a custom table with nodeId, IP and the DateTime and store the events in here... you could update totals on the content nodes if you like but this might create a lot of publishes on a busy site.
public class VideosApiController : UmbracoApiController
{
//
// GET: /Umbraco/Api/VideosApi/..
public VideosResults GetViews(int videoId)
{
Regardless of whether you use custom tables or not an API will let you get and update some values for these videos. In your API controller create set and get methods for Likes and Views and call the Sets via AJAX when the web visitors click them.
When you render the page via Razor get the the totals via your API get methods.
How many times viewed a video, a news etc... with Razor
Hi !
My name is ibrahim. I have a problem and I could not solve this problem. Can you help me?
How do I show a video of how many times you watched?
Thanks.
Best regards...
Hi,
I would create an MVC API and create a custom table with nodeId, IP and the DateTime and store the events in here... you could update totals on the content nodes if you like but this might create a lot of publishes on a busy site.
There is a really good walk through on how to create an API on Umbraco.tv http://umbraco.tv/videos/developer/fundamentals/api-controllers/introduction/ or you could work through
http://www.nibble.be/?p=224
https://our.umbraco.org/documentation/Reference/WebApi/
Your Controller will look something like:
namespace YourNameSpace.Controllers
{
public class VideosApiController : UmbracoApiController
{
//
// GET: /Umbraco/Api/VideosApi/..
public VideosResults GetViews(int videoId)
{
Regardless of whether you use custom tables or not an API will let you get and update some values for these videos. In your API controller create set and get methods for Likes and Views and call the Sets via AJAX when the web visitors click them.
When you render the page via Razor get the the totals via your API get methods.
HTH
Steve
is working on a reply...