public SearchResult <IzinCutiStatusDTO> GetDataByFilter(IzinCutiStatusSearchFilter filter)
        {
            if (string.IsNullOrEmpty(filter.SortName))
            {
                filter.SortName = "IzinCutiStatus_PK";
            }
            IzinCutiStatusQuery izinCutiStatusQuery = new IzinCutiStatusQuery(this.Db);

            var filteredRecords =
                izinCutiStatusQuery.GetQuery()
                .Where(izinCutiStatus =>
                       izinCutiStatus.Title.Contains(filter.Keyword));

            var displayedRecords = filteredRecords.
                                   SortBy(filter.SortName, filter.SortDir)
                                   .Skip(filter.Skip)
                                   .Take(filter.PageSize)
                                   .ToList();

            var searchResult = new SearchResult <IzinCutiStatusDTO>(filter);

            searchResult.Filter               = filter;
            searchResult.Count.TotalRecords   = izinCutiStatusQuery.GetTotalRecords();
            searchResult.Count.TotalFiltered  = filteredRecords.Count();
            searchResult.Count.TotalDisplayed = displayedRecords.Count();
            searchResult.Records              = displayedRecords;

            return(searchResult);
        }
        public IzinCutiStatusListModel Get(IzinCutiStatusSearchFilter searchFilter)
        {
            IzinCutiStatusListFormData       formData     = new IzinCutiStatusListFormData();
            SearchResult <IzinCutiStatusDTO> searchResult = izinCutiStatusSearch.GetDataByFilter(searchFilter);

            return(new IzinCutiStatusListModel()
            {
                FormData = formData,
                SearchResult = searchResult
            });
        }
        public IHttpActionResult Search([FromUri] IzinCutiStatusSearchFilter filter)
        {
            string accessType = "IzinCutiStatus_ViewAll";

            ThrowIfUserHasNoRole(accessType);
            if (filter == null)
            {
                throw new KairosException("Missing search filter parameter");
            }

            using (var izinCutiStatusSearch = new IzinCutiStatusSearch(Db))
            {
                var data = izinCutiStatusSearch.GetDataByFilter(filter);
                return(Ok(new SuccessResponse(data)));
            }
        }