コード例 #1
0
        public void CreateNewSyndicationItem(string title, string content, string url, NewsTypeContract itemType, string username)
        {
            m_authorizationManager.CheckUserCanAddNews();
            if (string.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentException("Username is empty, cannot add bookmark");
            }

            User user = m_userRepository.FindByUserName(username);

            if (user == null)
            {
                throw new ArgumentException(string.Format("Cannot locate user by username: '******'", username));
            }

            NewsSyndicationItem syndicationItem = new NewsSyndicationItem
            {
                CreateDate = DateTime.UtcNow,
                Title      = title,
                Url        = url,
                Text       = content,
                ItemType   = Mapper.Map <SyndicationItemType>(itemType),
                User       = user,
            };

            m_repository.Save(syndicationItem);
        }
コード例 #2
0
 public void CreateNewsSyndicationItem(string title, string content, string url, NewsTypeContract itemType, string username)
 {
     m_newsManager.CreateNewSyndicationItem(title, content, url, itemType, username);
 }