示例#1
0
        public ActionResult AddArticle(Article article)
        {
            var data = new object();

            article.CreatedDate = DateTime.Now;
            article.UpdateDate = DateTime.Now;

            try
            {
                using (var db = new DIYFE.EF.DIYFEEntities())
                {
                    db.Articles.Add(article);
                    db.SaveChanges();
                }
                StaticConfig.LoadStaticCache();
                data = new { success = true };
            }
            catch (Exception ex)
            {
                if (ex.InnerException.Message != null)
                {
                    data = new { success = false, message = ex.InnerException.Message };
                }
                else
                {
                    data = new { success = false, message = ex.Message + " Another reason why EF sucks" };
                }
                return Json(data);

            }

            return Json(data);
        }
示例#2
0
        public ActionResult Contact()
        {
            Article content = new Article()
            {
                Name="Contact",
                MainContent = "<p>Sure. You'd be surprised how far a hug goes with Geordi, or Worf. Talk about going nowhere fast. This is not about revenge. This is about justice. Computer, lights up! Our neural pathways have become accustomed to your sensory input patterns. Some days you get the bear, and some days the bear gets you. Maybe if we felt any human loss as keenly as we feel one of those close to us, human history would be far less bloody.</p>",
                URLLink = ""
            };

            return View(content);
        }
示例#3
0
        public ActionResult Ad_Space()
        {
            Article content = new Article()
            {
                Name = "Get Noticed With Ad Space",
                MainContent = "<p>Wait a minute - you've been declared dead. You can't give orders around here. Congratulations - you just destroyed the Enterprise. I can't. As much as I care about you, my first duty is to the ship. Smooth as an android's bottom, eh, Data? Well, that's certainly good to know. I suggest you drop it, Mr. Data. But the probability of making a six is no greater than that of rolling a seven. A surprise party? Mr. Worf, I hate surprise parties. I would *never* do that to you.</p>",
                URLLink = "adSpace"
            };

            return View("Contact", content);
        }