Ejemplo n.º 1
0
        public CustomerResource GetEmbeddedCustomer(string id)
        {
            if (_resourceContext.RequestedEmbeddedResources.Length == 0)
            {
                return(_mockedService.Customers.First());
            }

            var customer = _mockedService.Customers.First();
            var resource = new CustomerResource
            {
                CustomerId = customer.CustomerId,
                Age        = customer.Age,
                FirstName  = customer.FirstName,
                LastName   = customer.LastName,
            };

            foreach (var embeddedResource in customer.Embedded)
            {
                if (_resourceContext.RequestedEmbeddedResources.Contains(embeddedResource.Key))
                {
                    var halResource = embeddedResource.Value as IHalResource;
                    if (halResource != null)
                    {
                    }
                    resource.Embed(halResource, embeddedResource.Key);
                }
            }

            return(resource);
        }
Ejemplo n.º 2
0
 public CustomerResource PostPassThrough([FromBody] CustomerResource resource)
 {
     _mockedService.ServerReceivedResource = resource;
     return(new CustomerResource());
 }