Delete likes from topics.

This commit is contained in:
Michael 2017-03-26 11:28:57 -04:00
parent bcb75147a7
commit cd9437be6d

View file

@ -175,7 +175,9 @@ public void DeleteTopic(ForumTopic topic)
{
DeletePost(post);
}
db.ForumTopics.Remove(topic);
string id = topic.Id;
db.Likes.RemoveRange(db.Likes.Where(x => x.Topic == id));
db.ForumTopics.Remove(db.ForumTopics.FirstOrDefault(x=>x.Id==id));
}
public ActionResult AccessControl()
@ -225,7 +227,9 @@ public ActionResult SetPermission(string id, string role, string permission)
public void DeletePost(ForumPost post)
{
db.ForumPosts.Remove(post);
string id = post.Id;
db.ForumPosts.Remove(db.ForumPosts.FirstOrDefault(x=>x.Id==id));
}