public ActionResult DeleteBlog(long id, FormCollection collection) { try { BlogFactory DeleteBlog = new BlogFactory(); BlogEntity Blog = new BlogEntity(); Blog = DeleteBlog.GetBlogById(id); DataLayer.tblBlog NewBlog = new DataLayer.tblBlog(); NewBlog.BlogId = id; NewBlog.TopicId = Blog.TopicId; NewBlog.BlogName = Blog.BlogName; NewBlog.BlogHeading = Blog.BlogHeading; NewBlog.CreatedDate = Blog.CreatedDate; NewBlog.CreatedBy = Blog.CreatedBy; NewBlog.UpdatedDate = DateTime.Now; NewBlog.UpdatedBy = null; NewBlog.IsActive = false; // IsActive will be false in delete record DeleteBlog.SaveBlog(NewBlog); return(RedirectToAction("Blog")); } catch { return(View()); } }
// GET: Blog/Delete/5 public ActionResult DeleteBlog(long id) { BlogFactory EditBlog = new BlogFactory(); BlogEntity Blog = new BlogEntity(); Blog = EditBlog.GetBlogById(id); return(View(Blog)); }
// GET: Blog/Edit/5 public ActionResult EditBlog(long id) { try { BlogFactory EditBlog = new BlogFactory(); BlogEntity Blog = new BlogEntity(); Blog = EditBlog.GetBlogById(id); return(View(Blog)); } catch { return(View()); } finally { GetTopic(); } }