public TestimonialGenViewModel GenTestimonialSelectPaged(long SubComponentID, int PageNo, int PageSize, string sTerm)
        {
            TestimonialGenViewModel model = new TestimonialGenViewModel();
            var parStart = new SqlParameter("@Start", (PageNo - 1) * PageSize);
            var parEnd   = new SqlParameter("@PageSize", PageSize);
            //return result;
            var parSubCompID = new SqlParameter("@SubComponentID", DBNull.Value);

            if (SubComponentID != 0)
            {
                parSubCompID = new SqlParameter("@SubComponentID", SubComponentID);
            }

            var parSearchTerm = new SqlParameter("@SearchTerm", DBNull.Value);

            if (!(sTerm == null || sTerm == ""))
            {
                parSearchTerm.Value = sTerm;
            }
            var spOutput = new SqlParameter
            {
                ParameterName = "@TotalCount",
                SqlDbType     = System.Data.SqlDbType.BigInt,
                Direction     = System.Data.ParameterDirection.Output
            };

            model.TestimonialList = db.Database.SqlQuery <GenTestimonialsView>("GenTestimonialSelectAll @Start, @PageSize,@SearchTerm,@SubComponentID, @TotalCount out",
                                                                               parStart, parEnd, parSearchTerm, parSubCompID, spOutput).ToList();
            model.TotalRecords = int.Parse(spOutput.Value.ToString());

            return(model);
        }
Exemplo n.º 2
0
        // GET: Testimonials
        public ActionResult Index(long SCID = 0, int PageNo = 1, int PageSize = 3, string searchTerm = "")
        {
            TestimonialManageModel  model   = new TestimonialManageModel();
            TestimonialGenViewModel _tmodel = new TestimonialGenViewModel();

            _tmodel = ObjTestimonial.GenTestimonialSelectPaged(SCID, PageNo, PageSize, searchTerm);
            model.GenTestimonials       = _tmodel;
            model.Components            = ObjComp.GetComponentList("");
            model.GenComponentModelList = ObjComp.GetGenComponentList();//Component List
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_pvTetimonialList", model));
            }
            return(View(model));
        }