public async Task <CassetteList> GetAllAsync(int offset, int limit) { CassetteList response = new CassetteList() { Offset = offset, Limit = limit }; var specification = _specificationCreator.CreateSpecification("All"); response.Totalcount = await _realContainerRepo.GetCountAsync(specification); var res = await _realContainerRepo.GetListAsync(specification, "RealContainerId", string.Empty, offset, limit); response.Cassettes = _mapper.Map <List <RealContainer>, List <Cassette> >(res.ToList()); return(response); }
public async Task <List <RealContainer> > FindRealContainersAsync(string qrCode, int creditOrgId, int?typeId, int?excludeTypeId, string method, string sortField, string sortType, int offset, int limit) { var qrCodeParts = RealContainer.TryParseCompositeQR(qrCode); var isCompositeQR = qrCodeParts?.Length > 1; var searchCode = isCompositeQR ? qrCodeParts[(int)RealContainerQrEnum.ContainerNum].ToString("X").PadLeft(6, '0') : qrCode; var specification = _specificationCreator.CreateSpecification(method, searchCode, creditOrgId, typeId, excludeTypeId); // Получаем контейнеры по QR коду в базе var container = await _realcontainerRepository.GetListAsync(specification, sortField, sortType, offset, limit); // Если QR код составной и по нему найден контейнер необходимо осуществить проверку корректности QR кода if (isCompositeQR && container.Count == 1) { // Если значения в QR коде расходятся с данными из базы, помечаем контейнер к проверке if (container[0].CheckQRcode(qrCodeParts).Count != 0) { container[0].NeedCheck = true; await _realcontainerRepository.SetPropertiesAsync(new int[] { container[0].RealContainerId }, bNeedCheck : true); } } return(container); }