public static IEnumerable <IShipmentPackageStateDto> ToShipmentPackageStateDtoCollection(IEnumerable <ShipmentPackageId> ids) { var states = new List <IShipmentPackageStateDto>(); foreach (var id in ids) { var dto = new ShipmentPackageStateDtoWrapper(); dto.ShipmentPackageId = id; states.Add(dto); } return(states); }
public IShipmentPackageStateDto Get(string id, string fields = null) { try { var idObj = ShipmentPackagesControllerUtils.ParseIdString(id); var state = _shipmentPackageApplicationService.Get(idObj); if (state == null) { return(null); } var stateDto = new ShipmentPackageStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }