Skip to content

Instantly share code, notes, and snippets.

@pedroreys
Created March 12, 2012 17:29
Show Gist options
  • Save pedroreys/2023508 to your computer and use it in GitHub Desktop.
Save pedroreys/2023508 to your computer and use it in GitHub Desktop.
public interface IApiResource
{
void SetLocation(ResourceLocation location);
}
public class ResourceLocation
{
public Uri Location { get; private set; }
public void Set(Uri location)
{
Location = location;
}
}
public class CreateResponse : HttpResponseMessage
{
public CreateResponse()
{
StatusCode = HttpStatusCode.Created;
}
public CreateResponse(IApiResource resource) :this()
{
var location = new ResourceLocation();
resource.SetLocation(location);
Headers.Location = location.Location;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment