Files
OurUmbraco/NotificationsWeb/Api/NotificationsController.cs
T

75 lines
1.8 KiB
C#
Raw Normal View History

using NotificationsWeb.Services;
using System.Linq;
using System.Web.Http;
using Umbraco.Web.WebApi;
namespace NotificationsWeb.Api
{
public class NotificationsController:UmbracoApiController
{
public NotificationsController()
{
_notificationService = new NotificationService(DatabaseContext);
}
private readonly NotificationService _notificationService;
[HttpGet]
2015-02-12 13:42:43 +01:00
public string SubscribeToForumTopic(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
_notificationService.SubscribeToForumTopic(id, currentMemberId);
return "true";
}
return "false";
}
[HttpGet]
2015-02-12 13:42:43 +01:00
public string UnSubscribeFromForumTopic(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
_notificationService.UnSubscribeFromForumTopic(id, currentMemberId);
return "true";
}
return "false";
}
[HttpGet]
2015-02-12 13:42:43 +01:00
public string SubscribeToForum(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
_notificationService.SubscribeToForum(id, currentMemberId);
return "true";
}
return "false";
}
[HttpGet]
2015-02-12 13:42:43 +01:00
public string UnSubscribeFromForum(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
_notificationService.UnSubscribeFromForum(id, currentMemberId);
return "true";
}
return "false";
}
}
}