Update the /base calls in the notifications project
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace NotificationsWeb.Api
|
||||
{
|
||||
public class NotificationsController:UmbracoApiController
|
||||
{
|
||||
[HttpGet]
|
||||
public string SubscribeToForumTopic(int topicId)
|
||||
{
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0)
|
||||
{
|
||||
BusinessLogic.ForumTopic.Subscribe(topicId, currentMemberId);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string UnSubscribeFromForumTopic(int topicId)
|
||||
{
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0)
|
||||
{
|
||||
BusinessLogic.ForumTopic.UnSubscribe(topicId, currentMemberId);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string SubscribeToForum(int forumId)
|
||||
{
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0)
|
||||
{
|
||||
BusinessLogic.Forum.Subscribe(forumId, currentMemberId);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string UnSubscribeFromForum(int forumId)
|
||||
{
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0)
|
||||
{
|
||||
BusinessLogic.Forum.UnSubscribe(forumId, currentMemberId);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace NotificationsWeb.Library
|
||||
{
|
||||
public class Rest
|
||||
{
|
||||
public static string SubscribeToForumTopic(int topicId)
|
||||
{
|
||||
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
|
||||
|
||||
if (_currentMember > 0)
|
||||
{
|
||||
BusinessLogic.ForumTopic.Subscribe(topicId, _currentMember);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
|
||||
|
||||
public static string UnSubscribeFromForumTopic(int topicId)
|
||||
{
|
||||
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
|
||||
|
||||
if (_currentMember > 0)
|
||||
{
|
||||
BusinessLogic.ForumTopic.UnSubscribe(topicId, _currentMember);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
|
||||
public static string SubscribeToForum(int forumId)
|
||||
{
|
||||
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
|
||||
|
||||
if (_currentMember > 0)
|
||||
{
|
||||
BusinessLogic.Forum.Subscribe(forumId, _currentMember);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
|
||||
|
||||
public static string UnSubscribeFromForum(int forumId)
|
||||
{
|
||||
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
|
||||
|
||||
if (_currentMember > 0)
|
||||
{
|
||||
BusinessLogic.Forum.UnSubscribe(forumId, _currentMember);
|
||||
|
||||
return "true";
|
||||
}
|
||||
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,12 +225,12 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Api\NotificationsController.cs" />
|
||||
<Compile Include="BusinessLogic\Data.cs" />
|
||||
<Compile Include="BusinessLogic\Forum.cs" />
|
||||
<Compile Include="BusinessLogic\ForumTopic.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="EventHandlers\Forum.cs" />
|
||||
<Compile Include="Library\Rest.cs" />
|
||||
<Compile Include="Library\Xslt.cs" />
|
||||
<Compile Include="Pages\SheduledTaskTrigger.aspx.cs">
|
||||
<DependentUpon>SheduledTaskTrigger.aspx</DependentUpon>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
function SubscribeToForum(forumId){
|
||||
$.get("/base/Notifications/SubscribeToForum/" + forumId + ".aspx");
|
||||
$.get("/umbraco/api/Notifications/SubscribeToForum/?forumId=" + forumId);
|
||||
|
||||
jQuery(".SubscribeForum").hide("slow");
|
||||
jQuery(".UnSubscribeForum").show("slow");
|
||||
}
|
||||
|
||||
function UnSubscribeFromForum(forumId){
|
||||
$.get("/base/Notifications/UnSubscribeFromForum/" + forumId + ".aspx");
|
||||
$.get("/umbraco/api/Notifications/UnSubscribeFromForum/?forumId=" + forumId);
|
||||
|
||||
jQuery(".UnSubscribeForum").hide("slow");
|
||||
jQuery(".SubscribeForum").show("slow");
|
||||
@@ -14,14 +14,14 @@ function UnSubscribeFromForum(forumId){
|
||||
|
||||
|
||||
function SubscribeToForumTopic(topicId){
|
||||
$.get("/base/Notifications/SubscribeToForumTopic/" + topicId + ".aspx");
|
||||
$.get("/umbraco/api/Notifications/SubscribeToForumTopic/?topicId=" + topicId);
|
||||
|
||||
jQuery(".SubscribeTopic").hide("slow");
|
||||
jQuery(".UnSubscribeTopic").show("slow");
|
||||
}
|
||||
|
||||
function UnSubscribeFromForumTopic(topicId){
|
||||
$.get("/base/Notifications/UnSubscribeFromForumTopic/" + topicId + ".aspx");
|
||||
$.get("/umbraco/api/Notifications/UnSubscribeFromForumTopic/?topicId=" + topicId);
|
||||
|
||||
jQuery(".UnSubscribeTopic").hide("slow");
|
||||
jQuery(".SubscribeTopic").show("slow");
|
||||
@@ -30,13 +30,13 @@ function UnSubscribeFromForumTopic(topicId){
|
||||
|
||||
function NotificationTopicUnsubscribe(obj, topicId)
|
||||
{
|
||||
$.get("/base/Notifications/UnSubscribeFromForumTopic/" + topicId + ".aspx");
|
||||
$.get("/umbraco/api/Notifications/UnSubscribeFromForumTopic/?topicId=" + topicId);
|
||||
obj.parent().hide("slow");
|
||||
}
|
||||
|
||||
function NotificationForumUnsubscribe(obj, forumId)
|
||||
{
|
||||
$.get("/base/Notifications/UnSubscribeFromForum/" + forumId + ".aspx");
|
||||
$.get("/umbraco/api/Notifications/UnSubscribeFromForum/?forumId=" + forumId);
|
||||
obj.parent().hide("slow");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,14 @@ namespace uForum.Api
|
||||
{
|
||||
var node = new Node(forumId);
|
||||
|
||||
if (Members.GetCurrentMember().Id > 0 && Access.HasAccces(node.Id, Members.GetCurrentMember().Id))
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0 && Access.HasAccces(node.Id, currentMemberId))
|
||||
{
|
||||
var title = HttpContext.Current.Request["title"];
|
||||
var body = HttpContext.Current.Request["body"];
|
||||
var tags = HttpContext.Current.Request["tags"];
|
||||
|
||||
var topic = Businesslogic.Topic.Create(forumId, title, body, Members.GetCurrentMember().Id);
|
||||
var topic = Businesslogic.Topic.Create(forumId, title, body, currentMemberId);
|
||||
|
||||
return Xslt.NiceTopicUrl(topic.Id);
|
||||
}
|
||||
@@ -61,10 +62,11 @@ namespace uForum.Api
|
||||
[HttpPost]
|
||||
public string NewComment(int topicId, int itemsPerPage)
|
||||
{
|
||||
if (Members.GetCurrentMember().Id > 0 && topicId > 0)
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0 && topicId > 0)
|
||||
{
|
||||
var body = HttpContext.Current.Request["body"];
|
||||
var comment = Businesslogic.Comment.Create(topicId, body, Members.GetCurrentMember().Id);
|
||||
var comment = Businesslogic.Comment.Create(topicId, body, currentMemberId);
|
||||
|
||||
return Xslt.NiceCommentUrl(comment.TopicId, comment.Id, itemsPerPage);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,11 @@ namespace uPowers.Api
|
||||
{
|
||||
var comment = HttpContext.Current.Request["comment"] + "";
|
||||
|
||||
if (Members.GetCurrentMember().Id > 0)
|
||||
var currentMemberId = Members.GetCurrentMember().Id;
|
||||
if (currentMemberId > 0)
|
||||
{
|
||||
var action = new BusinessLogic.Action(alias);
|
||||
return action.Perform(Members.GetCurrentMember().Id, pageId, comment).ToString();
|
||||
return action.Perform(currentMemberId, pageId, comment).ToString();
|
||||
}
|
||||
|
||||
return "notLoggedIn";
|
||||
|
||||
Reference in New Issue
Block a user