-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnSubscribe.aspx.cs
43 lines (38 loc) · 1.28 KB
/
UnSubscribe.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class UnSubscribe : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Darili_User.IsAuthenticated())
{
try
{
LikeAndGoDataContext ctx = new LikeAndGoDataContext();
int eid = int.Parse(Request.QueryString["id"]);
int uid = Darili_User.Get_Uid_Local(Page.User.Identity.Name);
var predicate = PredicateBuilder.True<Event_Subscription>();
predicate = predicate.And(p => p.eid == eid).And(p => p.uid == uid);
var todel = ctx.Event_Subscription.Where(predicate).Select(p => p).ToList();
ctx.Event_Subscription.DeleteAllOnSubmit(todel);
ctx.SubmitChanges();
Response.Write(1);
}
catch
{
}
}
else
{
Response.StatusCode = 401;
Response.End();
}
}
}
}