public void Delete(Topic topic) { foreach (Message message in topic.Messages) { Provider.DeleteListItem(ForumConstants.Lists_Posts, message.Id); } Provider.DeleteListItem(ForumConstants.Lists_Topics, topic.Id); }
public static SharePointListItem CreateDto(Topic topic) { string[] topicValues = { "Title", topic.Name, "ForumID", topic.ForumId.ToString(), "Views", topic.Views.ToString(), "TopicStarterID", topic.TopicStarterId.ToString(), }; return new SharePointListItem(topic.Id, topicValues); }
public static Topic CreateDomainObject(SharePointListItem item) { Topic topic = new Topic(item.Id, Convert.ToInt32(item["ForumID"]), item["Title"]); topic.Views = Convert.ToInt32(item["Views"]); topic.TopicStarterId = Convert.ToInt32(item["TopicStarterID"]); topic.Author = RepositoryRegistry.ForumUserRepository.GetBySharePointId(topic.TopicStarterId); // Built in values from SharePoint list // TODO might be the wrong value topic.LastPost = Convert.ToDateTime(item["Modified"]); return topic; }
public int Save(Topic topic) { SharePointListItem listItem = TopicMapper.CreateDto(topic); int newTopicId = 0; if (topic.Id == 0) { newTopicId = Provider.AddListItem(ForumConstants.Lists_Topics, listItem); RepositoryRegistry.ForumRepository.IncreaseCount(topic.ForumId); } else { newTopicId = Provider.UpdateListItem(ForumConstants.Lists_Topics, listItem); } return newTopicId; }
public void Delete(Topic topic) { _dao.Delete(topic); }
public int Save(Topic topic) { return _dao.Save(topic); }
/// <summary> /// Setups the default values. /// </summary> public override void AddSampleData() { Topic topic = new Topic(1, "Welcome to your new SharePoint Forum"); topic.TopicStarterId = 1; RepositoryRegistry.TopicRepository.Save(topic); }