2015-02-17 11:51:06 +01:00
|
|
|
using NotificationsWeb.Services;
|
|
|
|
|
using System.Linq;
|
2014-09-14 17:18:04 +02:00
|
|
|
using System.Web.Http;
|
|
|
|
|
using Umbraco.Web.WebApi;
|
|
|
|
|
|
|
|
|
|
namespace NotificationsWeb.Api
|
|
|
|
|
{
|
|
|
|
|
public class NotificationsController:UmbracoApiController
|
|
|
|
|
{
|
|
|
|
|
[HttpGet]
|
2015-02-12 13:42:43 +01:00
|
|
|
public string SubscribeToForumTopic(int id)
|
2014-09-14 17:18:04 +02:00
|
|
|
{
|
|
|
|
|
var currentMemberId = Members.GetCurrentMember().Id;
|
|
|
|
|
if (currentMemberId > 0)
|
|
|
|
|
{
|
2015-02-17 11:51:06 +01:00
|
|
|
using(var ns = new NotificationService())
|
|
|
|
|
{
|
|
|
|
|
ns.SubscribeToForumTopic(id, currentMemberId);
|
|
|
|
|
}
|
2014-09-14 17:18:04 +02:00
|
|
|
|
|
|
|
|
return "true";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "false";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
2015-02-12 13:42:43 +01:00
|
|
|
public string UnSubscribeFromForumTopic(int id)
|
2014-09-14 17:18:04 +02:00
|
|
|
{
|
|
|
|
|
var currentMemberId = Members.GetCurrentMember().Id;
|
|
|
|
|
if (currentMemberId > 0)
|
|
|
|
|
{
|
2015-02-17 11:51:06 +01:00
|
|
|
using (var ns = new NotificationService())
|
|
|
|
|
{
|
|
|
|
|
ns.UnSubscribeFromForumTopic(id, currentMemberId);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-14 17:18:04 +02:00
|
|
|
|
|
|
|
|
return "true";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "false";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
2015-02-12 13:42:43 +01:00
|
|
|
public string SubscribeToForum(int id)
|
2014-09-14 17:18:04 +02:00
|
|
|
{
|
|
|
|
|
var currentMemberId = Members.GetCurrentMember().Id;
|
|
|
|
|
if (currentMemberId > 0)
|
|
|
|
|
{
|
2015-02-17 11:51:06 +01:00
|
|
|
using(var ns = new NotificationService())
|
|
|
|
|
{
|
|
|
|
|
ns.SubscribeToForum(id, currentMemberId);
|
|
|
|
|
}
|
2014-09-14 17:18:04 +02:00
|
|
|
|
|
|
|
|
return "true";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "false";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
2015-02-12 13:42:43 +01:00
|
|
|
public string UnSubscribeFromForum(int id)
|
2014-09-14 17:18:04 +02:00
|
|
|
{
|
|
|
|
|
var currentMemberId = Members.GetCurrentMember().Id;
|
|
|
|
|
if (currentMemberId > 0)
|
|
|
|
|
{
|
2015-02-17 11:51:06 +01:00
|
|
|
using (var ns = new NotificationService())
|
|
|
|
|
{
|
|
|
|
|
ns.UnSubscribeFromForum(id, currentMemberId);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-14 17:18:04 +02:00
|
|
|
|
|
|
|
|
return "true";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "false";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|