Models.NewsItem.CreatePost C# (CSharp) Method

CreatePost() public static method

public static CreatePost ( string PostTitle, string Post, int AuthorID, System.DateTime DatePosted ) : bool
PostTitle string
Post string
AuthorID int
DatePosted System.DateTime
return bool
        public static bool CreatePost(string PostTitle, string Post, int AuthorID, DateTime DatePosted)
        {
            //context should be hidden behind an interface probably
            string uname = HttpContext.Current.User.Identity.Name;
            NewsItem item = new NewsItem()
            {
                Title = PostTitle,
                Content = Post,
                UserId = AuthorID,
                CreatedOn = DatePosted,
                ModifiedOn = DatePosted,
                CreatedBy = uname,
                ModifiedBy = uname
            };

            var ctx = new Models.ICCData();

            ctx.NewsItems.InsertOnSubmit(item);

            ctx.SubmitChanges();
            return true;
        }