Beispiel #1
0
        public IActionResult ManageWallet(DataTablesParam param, string EName)
        {
            List <ManageUserWallet> list = new List <ManageUserWallet>();

            int pageNo = 1;

            if (param.iDisplayStart >= param.iDisplayLength)
            {
                pageNo = (param.iDisplayStart / param.iDisplayLength) + 1;
            }

            int totalCount = 0; //total records in table

            //Search by department,employeeName,and Country. 'param.sSearch' has the character from the implicit search on the view
            if (param.sSearch != null)
            {
                //get tottal count of search employee
                totalCount = _userBussiness.TotalCountOfUsers(param.sSearch);

                //retrieve the list of search of searched employee
                list = _userBussiness.SearchUser(param.sSearch, pageNo, param.iDisplayLength);
            }

            //Datatable Exrernal Search (by employeeName)
            else if (!string.IsNullOrEmpty(EName))
            {
                totalCount = _userBussiness.TotalCountOfUsers(EName);

                list = _userBussiness.SearchUser(EName, pageNo, param.iDisplayLength);
            }
            //Get All Employee without any search params
            else
            {
                totalCount = _userBussiness.TotalCountOfUsers();

                list = _userBussiness.GetUserRecords(pageNo, param.iDisplayLength);
            }
            return(Json(new
            {
                aaData = list,                     // contains actual data to be posted.
                sEcho = param.sEcho,               // tells the sequence of display.
                iTotalDisplayRecords = totalCount, //specify the total records to be displayed
                iTotalRecords = totalCount,        // the total number of data posted
            }));
        }