public ImageAlbumGenViewModel GenImageAlbumSelectPaged(long SubComponentID, int PageNo, int PageSize, string sTerm) { ImageAlbumGenViewModel model = new ImageAlbumGenViewModel(); 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.ImageAlbumList = db.Database.SqlQuery <GenImageAlbumView>("GenImageAlbumSelectAll @Start, @PageSize,@SearchTerm,@SubComponentID, @TotalCount out", parStart, parEnd, parSearchTerm, parSubCompID, spOutput).ToList(); model.TotalRecords = int.Parse(spOutput.Value.ToString()); return(model); }
// GET: Images public ActionResult Index(long SCID = 0, int PageNo = 1, int PageSize = 3, string searchTerm = "") { ImageAlbumManageModel model = new ImageAlbumManageModel(); ImageAlbumGenViewModel _imodel = new ImageAlbumGenViewModel(); _imodel = ObjImgAlbum.GenImageAlbumSelectPaged(SCID, PageNo, PageSize, searchTerm); model.GenImageAlbums = _imodel; model.Components = ObjComp.GetComponentList(""); model.GenComponentModelList = ObjComp.GetGenComponentList();//Component List if (Request.IsAjaxRequest()) { return(PartialView("_pvImageAlbumList", model)); } return(View(model)); }