1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Web/Models/JsonNotificationResult.cs

56 lines
1.5 KiB
C#
Raw Normal View History

using System.Web.Mvc;
2011-08-09 00:50:48 +03:00
namespace NzbDrone.Web.Models
{
public class JsonNotificationResult
2011-08-09 00:50:48 +03:00
{
private JsonNotificationResult()
2011-08-09 00:50:48 +03:00
{
Text = string.Empty;
}
public string Title { get; set; }
public string Text { get; set; }
public NotificationType NotificationType { get; set; }
public static JsonResult Info(string title, string text)
{
return GetJsonResult(NotificationType.Info, title, text);
}
public static JsonResult Info(string title)
{
return GetJsonResult(NotificationType.Info, title, string.Empty);
}
public static JsonResult Error(string title, string text)
{
return GetJsonResult(NotificationType.Error, title, text);
}
public static JsonResult Opps(string text)
{
return GetJsonResult(NotificationType.Error, "Opps!", text);
}
public static JsonResult GetJsonResult(NotificationType notificationType, string title, string text)
{
return new JsonResult
{
Data = new JsonNotificationResult { NotificationType = notificationType, Title = title, Text = text },
ContentType = null,
ContentEncoding = null,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
2011-08-09 00:50:48 +03:00
}
public enum NotificationType
{
Info,
Error
}
}