예제 #1
0
        public EventWrapperFull CreateEvent(string content, string title, FeedType type)
        {
            CommunitySecurity.DemandPermissions(NewsConst.Action_Add);

            if (string.IsNullOrWhiteSpace(title))
            {
                throw new ArgumentException("Can't create feed with empty title", "title");
            }

            var feed = new Web.Community.News.Code.Feed
            {
                Caption  = title,
                Text     = content,
                Creator  = SecurityContext.CurrentAccount.ID.ToString(),
                Date     = DateTime.UtcNow,
                FeedType = type
            };

            FeedStorage.SaveFeed(feed, false, type);

            return(new EventWrapperFull(feed));
        }
예제 #2
0
        public EventWrapperFull CreateEvent(string content, string title, FeedType type)
        {
            CommunitySecurity.DemandPermissions(NewsConst.Action_Add);

            if (string.IsNullOrWhiteSpace(title))
                throw new ArgumentException("Can't create feed with empty title", "title");

            var feed = new Web.Community.News.Code.Feed
                           {
                               Caption = title,
                               Text = content,
                               Creator = SecurityContext.CurrentAccount.ID.ToString(),
                               Date = DateTime.UtcNow,
                               FeedType = type
                           };

            FeedStorage.SaveFeed(feed, false, type);
            
            return new EventWrapperFull(feed);
        }