Exemple #1
0
        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);
        }
 public Collection( )
 {
     links = new List<Link>( );
     template = new Template( );
     items = new List<Item>();
     error = new CollectionMessage(  );
     warnings = new CollectionMessage(  );
 }
Exemple #3
0
 public Collection( )
 {
     links    = new List <Link>( );
     template = new Template( );
     items    = new List <Item>();
     error    = new CollectionMessage(  );
     warnings = new CollectionMessage(  );
 }
Exemple #4
0
 public Item( )
 {
     links    = new List <Link>( );
     warnings = new CollectionMessage(  );
 }