예제 #1
0
        public void Post()
        {
            if (!Permission.PremissionNeed(Request, Response, Session, UserRank.TEACHER))
            {
                return;
            }

            User   user    = (User)Session["user"];
            string title   = Request.Form["title"];
            string content = Request.Form["content"];

            if (title.Length != 0 && content.Length != 0)
            {
                log.Info("uid:" + user.uid + "发布新闻:" + title);
                News news = new News
                {
                    publisher = user.uid,
                    title     = title,
                    content   = content,
                    date      = DateTime.Now
                };
                NewsView.PostNewNews(news);
            }

            newsCache = NewsView.GetAllNews();
            Response.Redirect("/News");
        }