コード例 #1
0
ファイル: Item.cs プロジェクト: jcteague/hypermedia-tools
        public static HttpResponseMessage For <T>(IEnumerable <Data> data, Guid entity_id, IList <string> warnings)
        {
            var href = new Link {
                href = UrlBuilder.CreateResourceUrl <T>(entity_id), prompt = "View Details"
            };
            var warnings_message = new CollectionMessage {
                title = "Warnings"
            };

            if (warnings.Count > 0)
            {
                warnings_message.messages = warnings;
            }
            var item = new Item {
                data = data, self = href, warnings = warnings_message
            };

            var http_content          = new ObjectContent(item.GetType( ), item, new JsonMediaTypeFormatter( ));
            var http_response_message = new HttpResponseMessage(HttpStatusCode.Created)
            {
                Content = http_content
            };

            return(http_response_message);
        }
コード例 #2
0
 public Collection( )
 {
     links = new List<Link>( );
     template = new Template( );
     items = new List<Item>();
     error = new CollectionMessage(  );
     warnings = new CollectionMessage(  );
 }
コード例 #3
0
 public Collection( )
 {
     links    = new List <Link>( );
     template = new Template( );
     items    = new List <Item>();
     error    = new CollectionMessage(  );
     warnings = new CollectionMessage(  );
 }
コード例 #4
0
ファイル: Item.cs プロジェクト: jcteague/hypermedia-tools
 public Item( )
 {
     links    = new List <Link>( );
     warnings = new CollectionMessage(  );
 }