public ActionResult Create(FormCollection collection)
 {
     try
     {
         // TODO: Add insert logic here
         string status = "";
         Services.Post_Service postService = new Services.Post_Service();
         if (ModelState.IsValid)
         {
             Faq_model model = new Faq_model();
             model.answer    = Request.Form["answer"].ToString();
             model.questions = Request.Form["query"].ToString();
             status          = postService.FaqSave(model);
         }
         else
         {
             status = "PostDataError";
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#2
0
        public ActionResult Login(Get_Post_List model)
        {
            Services.Post_Service services = new Services.Post_Service();
            Get_Post_List         list     = new Get_Post_List();
            var session = Session["username"];

            if (session == null)
            {
                list = services.LoginService(model.UserDetails);
                if (list.message == "valid")
                {
                    Session["username"] = model.UserDetails.username;
                    Session["attempt"]  = "success";
                }
                else
                {
                    Session["attempt"] = "failed";
                }
            }
            else
            {
                list.message = "valid";
            }
            ViewBag.User  = Session["username"];
            ViewBag.Login = list.message;
            return(RedirectToAction("Index"));
        }
        public ActionResult ViewCategoryItems(string category, int id)
        {
            Services.Post_Service services = new Services.Post_Service();
            Get_Post_List         result   = services.PostGetByCategoryId(id);

            return(View("ViewCategoryItems", result));
        }
示例#4
0
        public JsonResult Search(Search_Model input)
        {
            Get_Post_List model = new Get_Post_List();

            Services.Post_Service services = new Services.Post_Service();
            model = services.SearchService(input.searchStr);
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Delete(string id)
        {
            Services.Post_Service services = new Services.Post_Service();
            Get_Post_List         list     = services.PostDeleteContent(id);

            //ViewBag.Title = list.list[0].seoTitle;
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Show_Post(string categoryid, string id)
        {
            Services.Post_Service services = new Services.Post_Service();
            Get_Post_List         list     = services.PostGetContent(id);
            var session = Session["username"];

            if (session != null)
            {
                ViewBag.User = session.ToString();
            }
            //ViewBag.Title = list.list[0].seoTitle;
            return(View("Show_Post", list));
        }
 public ActionResult Edit(string categoryid, string id)
 {
     try
     {
         Services.Post_Service services = new Services.Post_Service();
         Get_Post_List         list     = services.PostGetContent(id);
         // TODO: Add update logic here
         return(View("CustomPostIndex", list));
     }
     catch
     {
         return(View());
     }
 }
        public JsonResult Update(Post_Model postobj)
        {
            string status = "";

            Services.Post_Service postService = new Services.Post_Service();
            if (ModelState.IsValid)
            {
                status = postService.Update(postobj);
            }
            else
            {
                status = "PostDataError";
            }
            return(Json(status, JsonRequestBehavior.AllowGet));
        }
        public ActionResult FAQ()
        {
            validate();
            Get_Post_List list = null;

            Services.Post_Service postService = new Services.Post_Service();
            if (ModelState.IsValid)
            {
                list         = new Get_Post_List();
                list.FaqList = postService.FaqGetAll();
            }
            else
            {
                list.message = "PostDataError";
            }

            return(View("FAQ", list));
        }
 public JsonResult GetCategoryList()
 {
     Services.Post_Service services = new Services.Post_Service();
     return(Json(services.GetCategoryList(), JsonRequestBehavior.AllowGet));
 }
 public JsonResult GetByCategoryId(int id)
 {
     Services.Post_Service services = new Services.Post_Service();
     return(Json(services.PostGetByCategoryId(id), JsonRequestBehavior.AllowGet));
 }
 public JsonResult GetAll(int pageIndex)
 {
     Services.Post_Service services = new Services.Post_Service();
     return(Json(services.PostGetAll(pageIndex), JsonRequestBehavior.AllowGet));
 }
 public JsonResult GetSideLinks(int start, int pageIndex)
 {
     Services.Post_Service services = new Services.Post_Service();
     return(Json(services.PostGetLatestPosts(start, pageIndex), JsonRequestBehavior.AllowGet));
 }