public bool AddTopic(AddTopic topic) { if (topic.SubTopicName != null) { var dbTopic = dbReference.BlogTopics.FirstOrDefault(m => m.TopicName == topic.TopicName); if (dbTopic == null) { var parentTopic = new BlogTopic() { TopicName = topic.TopicName }; dbReference.BlogTopics.Add(parentTopic); dbReference.SaveChanges(); var childTopic = new BlogTopic() { ParentId = parentTopic.TopicId, TopicName = topic.SubTopicName }; dbReference.BlogTopics.Add(childTopic); dbReference.SaveChanges(); } else { var childTopic = new BlogTopic() { ParentId = dbTopic.TopicId, TopicName = topic.SubTopicName }; dbReference.BlogTopics.Add(childTopic); dbReference.SaveChanges(); } return(true); } return(false); }
public static String AddTopic(IExecuteSystem es, String groupId, String title, String text = null, Boolean?fromGroup = null, List <String> attachments = null) { var method = new AddTopic { GroupId = groupId, Title = title, Text = text, FromGroup = fromGroup, Attachments = attachments }; return(es.Execute(method)); }
public String VisitAddTopic(AddTopic method, JToken data) { return(data.SafeGetValue <String>("response")); }
public String VisitAddTopic(AddTopic method, T data) { return(this.boardVisitor.VisitAddTopic(method, data)); }
public ActionResult AddTopic(AddTopic topic) { var topicAdded = _blogManager.AddTopic(topic); return(Json(new { success = topicAdded }, JsonRequestBehavior.AllowGet)); }