Created
March 12, 2012 17:29
-
-
Save pedroreys/2023508 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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