Esempio n. 1
0
        public VideoAlbumGenViewModel GenVideoAlbumSelectPaged(long SubComponentID, int PageNo, int PageSize, string sTerm)
        {
            VideoAlbumGenViewModel model = new VideoAlbumGenViewModel();
            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.VideoAlbumList = db.Database.SqlQuery <GenVideoAlbumView>("GenVideoAlbumSelectAll @Start, @PageSize,@SearchTerm,@SubComponentID, @TotalCount out",
                                                                            parStart, parEnd, parSearchTerm, parSubCompID, spOutput).ToList();
            model.TotalRecords = int.Parse(spOutput.Value.ToString());

            return(model);
        }
        // GET: Video
        public ActionResult Index(long SCID = 0, int PageNo = 1, int PageSize = 3, string searchTerm = "")
        {
            VideoAlbumManageModel  model   = new VideoAlbumManageModel();
            VideoAlbumGenViewModel _vmodel = new VideoAlbumGenViewModel();

            _vmodel = ObjVideoAlbum.GenVideoAlbumSelectPaged(SCID, PageNo, PageSize, searchTerm);
            model.GenVideoAlbums        = _vmodel;
            model.Components            = ObjComp.GetComponentList("");
            model.GenComponentModelList = ObjComp.GetGenComponentList();//Component List
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_pvVideoAlbumList", model));
            }
            return(View(model));
        }