Skip to content

Instantly share code, notes, and snippets.

@falafelsoftware
Created August 13, 2012 11:16
Show Gist options
  • Save falafelsoftware/3339673 to your computer and use it in GitHub Desktop.
Save falafelsoftware/3339673 to your computer and use it in GitHub Desktop.
Falafel Dashboard HelloWorld Widget
using System;
using System.Linq;
using System.Web.Mvc;
using FalafelDashboard.Common;
using FalafelDashboard.Configuration;
using SitefinityWebApp.Mvc.Areas.HelloWorld.Models;
using Telerik.Sitefinity;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Modules.Pages;
using Telerik.Sitefinity.Pages.Model;
namespace SitefinityWebApp.Mvc.Areas.HelloWorld.Controllers
{
/// <summary>
/// Controller that provides functionality
/// </summary>
public class HelloWorldController : Controller
{
#region Constants and Fields
#endregion
#region Properties
/// <summary>
/// The message to display in the hello world view
/// </summary>
public string Message { get; set; }
#endregion
#region Methods
public ActionResult Index()
{
try
{
if (Utils.IsWidgetAllowed("HelloWorld"))
{
//INITIALIZE VIEW MODEL
var model = new HelloWorldViewModel { Message = "Hello world dashboard widget"};
//TODO: POPULATE VIEW MODEL WITH DATA
//RETURN AREA VIEW WITH VIEW MODEL
return View("../../Areas/HelloWorld/Views/HelloWorld/Index", model);
}
return View("../../Areas/HelloWorld/Views/HelloWorld/Unauthorized");
}
catch (Exception ex)
{
return View("../../Areas/HelloWorld/Views/HelloWorld/Error", ex);
}
}
#endregion
}
}
namespace SitefinityWebApp.Mvc.Areas.HelloWorld.Models
{
public class HelloWorldViewModel
{
public string Message { get; set; }
}
}
@model SitefinityWebApp.Mvc.Areas.HelloWorld.Models.HelloWorldViewModel
<div class="dashboard_right_now">
<strong>@Model.Message</strong>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment