2012-01-19 03:58:32 +00:00
|
|
|
using System.Web.Mvc;
|
|
|
|
|
2011-08-08 21:50:48 +00:00
|
|
|
namespace NzbDrone.Web.Models
|
|
|
|
{
|
|
|
|
public class NotificationResult
|
|
|
|
{
|
|
|
|
public NotificationResult()
|
|
|
|
{
|
|
|
|
Text = string.Empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
public string Title { get; set; }
|
|
|
|
public string Text { get; set; }
|
|
|
|
public NotificationType NotificationType { get; set; }
|
|
|
|
|
|
|
|
|
2012-01-19 03:58:32 +00:00
|
|
|
public static JsonResult Info(string title, string text)
|
|
|
|
{
|
|
|
|
return GetJsonResult(NotificationType.Error, title, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static JsonResult Error(string title, string text)
|
|
|
|
{
|
|
|
|
return GetJsonResult(NotificationType.Error, title, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static JsonResult GetJsonResult(NotificationType notificationType, string title, string text)
|
|
|
|
{
|
|
|
|
return new JsonResult
|
|
|
|
{
|
|
|
|
Data = new NotificationResult { NotificationType = notificationType, Title = title, Text = text },
|
|
|
|
ContentType = null,
|
|
|
|
ContentEncoding = null,
|
|
|
|
JsonRequestBehavior = JsonRequestBehavior.AllowGet
|
|
|
|
};
|
|
|
|
}
|
2011-08-08 21:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public enum NotificationType
|
|
|
|
{
|
|
|
|
Info,
|
|
|
|
Error
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|