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); }
public MeasuringDeviceController(IMeasuringDeviceService service, IEmployeeService employeeService, IMeasuringDeviceParameters measuringDeviceParameters, IEmployeeParameters employeeParameters) { this.Service = service; this.EmployeeService = employeeService; this.MeasuringDeviceParameters = measuringDeviceParameters; this.EmployeeParameters = employeeParameters; }
public ItemController(IItemService service, IEmployeeService employeeService, IItemParameters itemParameters, IEmployeeParameters employeeParameters) { this.Service = service; this.EmployeeService = employeeService; this.ItemParameters = itemParameters; this.EmployeeParameters = employeeParameters; }
public VehicleController(IVehicleService service, IEmployeeService employeeService, IVehicleParameters vehicleParameters, IEmployeeParameters employeeParameters) { this.Service = service; this.EmployeeService = employeeService; this.VehicleParameters = vehicleParameters; this.EmployeeParameters = employeeParameters; }
public Task <int> GetCountAsync(IEmployeeParameters parameters) { if (!String.IsNullOrEmpty(parameters.SearchString)) { GenericParameters.Filter = e => e.Name.Contains(GenericParameters.SearchString); } return(Repository.GetCountAsync(GenericParameters)); }
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); }
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); }
public EmployeeController(IEmployeeService service, IEmployeeParameters employeeParameters) { this.Service = service; this.EmployeeParameters = employeeParameters; }
public async Task <IEmployee> GetOneAsync(IEmployeeParameters employeeParameters) { return(await EmployeeRepository.GetOneAsync(employeeParameters)); }
public async Task <List <IEmployee> > GetAllAsync(IEmployeeParameters employeeParameters = null) { return(new List <IEmployee>(await EmployeeRepository.GetAllAsync(employeeParameters))); }