public ApiResponseModel <PaginatedList <Data.Entity.Employee> > GetAllEmployeePaginatedWithDetail([FromQuery] GetAllEmployeePaginatedRequestModel requestModel, [FromHeader] string displayLanguage)
        {
            var responseModel = new ApiResponseModel <PaginatedList <Data.Entity.Employee> >()
            {
                DisplayLanguage = displayLanguage
            };

            try
            {
                var searchFilter = new Business.Models.ProfileEmployee.ProfileEmployeeSearchFilter();
                searchFilter.CurrentPage              = requestModel.CurrentPage.HasValue ? requestModel.CurrentPage.Value : 1;
                searchFilter.PageSize                 = requestModel.PageSize.HasValue ? requestModel.PageSize.Value : 10;
                searchFilter.SortOn                   = requestModel.SortOn;
                searchFilter.SortDirection            = requestModel.SortDirection;
                searchFilter.Filter_ProfileId         = requestModel.ProfileId;
                searchFilter.Filter_Employee_Name     = requestModel.Employee_Name;
                searchFilter.Filter_Employee_LastName = requestModel.Employee_LastName;
                responseModel.Data                = _profileEmployeeService.GetAllEmployeePaginatedWithDetailBySearchFilter(searchFilter);
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Success;
                responseModel.ResultStatusMessage = "Success";
            }
            catch (Exception ex)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = ex.Message;
            }
            return(responseModel);
        }
Beispiel #2
0
        private PaginatedList <EmployeeCheckViewModel> GetAllEmployeeByProfileId(string userToken, string displayLanguage, ProfileEmployeeSearchFilter profileEmployeeSearchFilter)
        {
            //profile ait kullanıcı kayıtları listelenir
            // api'den çekim yapılacak
            var apiResponseModel = _profileEmployeeService.GetAllEmployeePaginatedWithDetailBySearchFilter(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileEmployeeSearchFilter);

            if (apiResponseModel.ResultStatusCode == ResultStatusCodeStatic.Success)
            {
                if (apiResponseModel.Data != null && apiResponseModel.Data.Items != null)
                {
                    var employeeCheckList = apiResponseModel.Data.Items.Select(x => new EmployeeCheckViewModel()
                    {
                        Checked  = false,
                        ID       = x.Id,
                        Name     = x.Name,
                        LastName = x.LastName,
                    }).ToList();
                    PaginatedList <EmployeeCheckViewModel> result = new PaginatedList <EmployeeCheckViewModel>(employeeCheckList, apiResponseModel.Data.TotalCount, apiResponseModel.Data.CurrentPage, apiResponseModel.Data.PageSize, apiResponseModel.Data.SortOn, apiResponseModel.Data.SortDirection);
                    return(result);
                }
                else
                {
                    return(new PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""));
                }
            }
            else
            {
                return(new PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""));
            }
        }