Example #1
0
        public async Task <IEnumerable <IEmployee> > GetAllAsync(IEmployeeParameters parameters)
        {
            GenericParameters = Mapper.Map <IGenericRepositoryParameters <EmployeeEntity> >(parameters);
            if (GenericParameters.Paged)
            {
                switch (GenericParameters.SortOrder)
                {
                case "Name":
                    GenericParameters.OrderBy = source => source.OrderBy(e => e.Name);
                    break;

                case "name_desc":
                    GenericParameters.OrderBy = source => source.OrderByDescending(e => e.Name);
                    break;

                default:
                    GenericParameters.OrderBy = source => source.OrderBy(e => e.ID);
                    break;
                }
                GenericParameters.Skip = (GenericParameters.PageNumber - 1) * GenericParameters.PageSize;
                GenericParameters.Take = GenericParameters.PageSize;
            }

            if (!String.IsNullOrEmpty(parameters.SearchString))
            {
                GenericParameters.Filter = e => e.Name.Contains(GenericParameters.SearchString);
            }
            var employeeList = (Mapper.Map <List <IEmployee> >(await Repository.GetAllAsync(GenericParameters)));

            return(employeeList);
        }
Example #2
0
 public MeasuringDeviceController(IMeasuringDeviceService service, IEmployeeService employeeService, IMeasuringDeviceParameters measuringDeviceParameters, IEmployeeParameters employeeParameters)
 {
     this.Service                   = service;
     this.EmployeeService           = employeeService;
     this.MeasuringDeviceParameters = measuringDeviceParameters;
     this.EmployeeParameters        = employeeParameters;
 }
Example #3
0
 public ItemController(IItemService service, IEmployeeService employeeService, IItemParameters itemParameters, IEmployeeParameters employeeParameters)
 {
     this.Service            = service;
     this.EmployeeService    = employeeService;
     this.ItemParameters     = itemParameters;
     this.EmployeeParameters = employeeParameters;
 }
Example #4
0
 public VehicleController(IVehicleService service, IEmployeeService employeeService, IVehicleParameters vehicleParameters, IEmployeeParameters employeeParameters)
 {
     this.Service            = service;
     this.EmployeeService    = employeeService;
     this.VehicleParameters  = vehicleParameters;
     this.EmployeeParameters = employeeParameters;
 }
Example #5
0
 public Task <int> GetCountAsync(IEmployeeParameters parameters)
 {
     if (!String.IsNullOrEmpty(parameters.SearchString))
     {
         GenericParameters.Filter = e => e.Name.Contains(GenericParameters.SearchString);
     }
     return(Repository.GetCountAsync(GenericParameters));
 }
Example #6
0
        public async Task <IEmployee> GetOneAsync(IEmployeeParameters parameters)
        {
            GenericParameters        = Mapper.Map <IGenericRepositoryParameters <EmployeeEntity> >(parameters);
            GenericParameters.Filter = e => e.ID == GenericParameters.ID;
            var employee = (Mapper.Map <IEmployee>(await Repository.GetOneAsync(GenericParameters)));

            return(employee);
        }
Example #7
0
        public async Task <StaticPagedList <IEmployee> > GetAllPagedListAsync(IEmployeeParameters employeeParameters)
        {
            var count = await EmployeeRepository.GetCountAsync(employeeParameters);

            var employeeList = await EmployeeRepository.GetAllAsync(employeeParameters);

            var employeePagedList = new StaticPagedList <IEmployee>(employeeList, employeeParameters.PageNumber.Value, employeeParameters.PageSize.Value, count);

            return(employeePagedList);
        }
Example #8
0
 public EmployeeController(IEmployeeService service, IEmployeeParameters employeeParameters)
 {
     this.Service            = service;
     this.EmployeeParameters = employeeParameters;
 }
Example #9
0
 public async Task <IEmployee> GetOneAsync(IEmployeeParameters employeeParameters)
 {
     return(await EmployeeRepository.GetOneAsync(employeeParameters));
 }
Example #10
0
 public async Task <List <IEmployee> > GetAllAsync(IEmployeeParameters employeeParameters = null)
 {
     return(new List <IEmployee>(await EmployeeRepository.GetAllAsync(employeeParameters)));
 }