Beispiel #1
0
        public ActionResult Update(DashboardWidgetModel m)
        {
            m.UpdateModel();
            CurrentDatabase.SubmitChanges();

            return(Redirect("/HomeWidgets"));
        }
Beispiel #2
0
 public ActionResult Embed(string id, bool preview = false)
 {
     try
     {
         var widget = new DashboardWidgetModel(id, CurrentDatabase);
         if (preview == true || widget.CacheHours == 0)
         {
             widget.CachePolicy = DashboardWidgetModel.CachePolicies.NeverCache.ToInt();
         }
         if (widget.CachePolicy != DashboardWidgetModel.CachePolicies.NeverCache.ToInt())
         {
             Response.SetCacheMinutes(widget.CacheHours * 60);
         }
         if (!widget.Roles.Intersect(CurrentDatabase.CurrentRoleIds()).Any())
         {
             throw new Exception("Not authorized");
         }
         string html = widget.Embed();
         return(Content(html, "text/html"));
     }
     catch (Exception e)
     {
         return(Content("Error: " + e.Message));
     }
 }
Beispiel #3
0
 public ActionResult Reorder(List <int> widgets)
 {
     try
     {
         DashboardWidgetModel.UpdateWidgetOrder(CurrentDatabase, widgets);
         return(Content("Widget order has been updated"));
     }
     catch (Exception ex)
     {
         return(Content("error: " + ex.ToString()));
     }
 }
Beispiel #4
0
 public ActionResult Manage(string id)
 {
     try
     {
         var model = new DashboardWidgetModel(id, CurrentDatabase);
         return(View(model));
     }
     catch
     {
         return(Content("Invalid widget"));
     }
 }