public ActionResult DeleteConfirmed(int id)
        {
            CategoryTopic categorytopic = db.CategoryTopics.Find(id);

            db.CategoryTopics.Remove(categorytopic);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //
        // GET: /Category/Delete/5

        public ActionResult Delete(int id = 0)
        {
            CategoryTopic categorytopic = db.CategoryTopics.Find(id);

            if (categorytopic == null)
            {
                return(HttpNotFound());
            }
            return(View(categorytopic));
        }
 public ActionResult Edit(CategoryTopic categorytopic)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categorytopic).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categorytopic));
 }
        public ActionResult Create(CategoryTopic categorytopic)
        {
            if (ModelState.IsValid)
            {
                db.CategoryTopics.Add(categorytopic);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(categorytopic));
        }
        public ActionResult Create(PostModels postmodels)
        {
            if (ModelState.IsValid)
            {
                CategoryTopic categoryTopic = db.CategoryTopics.Find(postmodels.CategoryId);
                postmodels.PosterName = User.Identity.Name;
                postmodels.DateSubmit = DateTime.Now.Date;
                categoryTopic.PostModelses.Add(postmodels);
                //   db.Posts.Add(postmodels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(postmodels));
        }