Exemple #1
0
        public ActionResult Create(long category, string subject, string context)
        {
            var account = AccountDAO.SelectItemByLogin(User.Identity.Name).Id;

            ThreadDAO.Insert(new Thread
            {
                Subject  = subject,
                Category = category,
                Created  = DateTime.Now,
                Updated  = DateTime.Now,
                Account  = account,
                Status   = ThreadStatusDAO.SelectByName("Idle"),
                Views    = 0
            });
            var thread = ThreadDAO.SelectBySubject(subject).Id;

            PostDAO.Insert(new Post
            {
                Context     = context,
                Account     = account,
                Created     = DateTime.Now,
                Thread      = thread,
                Status      = PostStatusDAO.SelectByName("Idle"),
                ThreadOrder = 1
            });
            return(RedirectToAction("Thread", new { id = thread, page = (PostDAO.SelectLastPostByThread(thread.Value) - 1) / 15 }));
        }