Esempio n. 1
0
 public ActionResult PostBlog(BLOGS blog)
 {
     if (Request.IsAuthenticated)
     {
         DateTime now = DateTime.Now;
         blog.USER_ID   = User.Identity.GetUserId();
         blog.VOID_IND  = "n";
         blog.CREATE_DT = now;
         db.Blog.Add(blog);
         db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Esempio n. 2
0
        public async Task <ActionResult> doEdit(BLOGS blog)
        {
            int      blogID       = blog.BLOG_ID;
            DateTime now          = DateTime.Now;
            var      previousBlog = db.Blog.SingleOrDefault(b => b.BLOG_ID == blogID);

            if (Request.IsAuthenticated)
            {
                previousBlog.BLOG_TEXT = blog.BLOG_TEXT;
                previousBlog.TITLE     = blog.TITLE;
                previousBlog.UPDATE_DT = now;
                previousBlog.CREATE_DT = blog.CREATE_DT;
                previousBlog.VOID_IND  = "n";
                await db.SaveChangesAsync();

                return(RedirectToAction("ListView", "Blog"));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }