public async Task <IEnumerable <SupplierToReturnDTO> > GetByParams(SupplierParamsDTO param) { var supplierFromRepo = await _unitOfWork.Supplier.GetAll(); if (param.SupplierName != null) { supplierFromRepo = supplierFromRepo.Where(s => s.SupplierName.Contains(param.SupplierName)); } return(_mapper.Map <IEnumerable <SupplierToReturnDTO> >(supplierFromRepo)); }
public async Task <IActionResult> GetFilteredSuppliers([FromQuery] SupplierParamsDTO param) { var suppliers = await _supplierService.GetByParams(param); if (suppliers == null) { return(NoContent()); } return(Ok(suppliers)); }