@@ -112,6 +112,15 @@ web::json::value ModelBase::toJson( const std::shared_ptr<HttpContent>& content
112112 }
113113 return value;
114114}
115+ web::json::value ModelBase::toJson( const std::shared_ptr<utility::datetime >& val )
116+ {
117+ web::json::value retVal;
118+ if (val != nullptr)
119+ {
120+ retVal = toJson(*val);
121+ }
122+ return retVal;
123+ }
115124bool ModelBase::fromString( const utility::string_t& val, bool &outVal )
116125{
117126 utility::stringstream_t ss(val);
@@ -242,6 +251,19 @@ bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr<HttpCo
242251 }
243252 return ok;
244253}
254+ bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr<utility::datetime >& outVal )
255+ {
256+ bool ok = false ;
257+ if (outVal == nullptr)
258+ {
259+ outVal = std::shared_ptr< utility::datetime> (new utility::datetime());
260+ }
261+ if( outVal != nullptr )
262+ {
263+ ok = fromJson(web::json::value::parse(val), *outVal);
264+ }
265+ return ok;
266+ }
245267bool ModelBase::fromJson( const web::json::value& val, bool & outVal )
246268{
247269 outVal = ! val.is_boolean() ? false : val.as_bool();
@@ -319,6 +341,19 @@ bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr<HttpConte
319341 }
320342 return result;
321343}
344+ bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr<utility::datetime > &outVal )
345+ {
346+ bool ok = false ;
347+ if (outVal == nullptr)
348+ {
349+ outVal = std::shared_ptr< utility::datetime> (new utility::datetime());
350+ }
351+ if( outVal != nullptr )
352+ {
353+ ok = fromJson(val, *outVal);
354+ }
355+ return ok;
356+ }
322357std::shared_ptr<HttpContent > ModelBase::toHttpContent( const utility::string_t& name, bool value, const utility::string_t& contentType )
323358{
324359 std::shared_ptr< HttpContent> content( new HttpContent );
@@ -414,6 +449,18 @@ std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t&
414449 }
415450 return content;
416451}
452+ std::shared_ptr<HttpContent > ModelBase::toHttpContent(const utility::string_t& name, const std::shared_ptr<utility::datetime >& value , const utility::string_t& contentType )
453+ {
454+ std::shared_ptr< HttpContent> content( new HttpContent );
455+ if (value != nullptr )
456+ {
457+ content-> setName ( name );
458+ content-> setContentDisposition ( utility::conversions::to_string_t(" form-data" ) );
459+ content-> setContentType ( contentType );
460+ content-> setData ( std::shared_ptr< std::istream> ( new std::stringstream( utility::conversions::to_utf8string( toJson(*value).serialize() ) ) ) );
461+ }
462+ return content;
463+ }
417464bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent > val, bool & outVal )
418465{
419466 utility::string_t str;
0 commit comments