Last active
August 29, 2015 14:04
-
-
Save pmhsfelix/0ef05df788e4d4abfc49 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Web.Http; | |
using System.Web.Http.Routing; | |
namespace Drum.Example.Controllers | |
{ | |
[RoutePrefix("api/resources")] | |
public class ResourceController : ApiController | |
{ | |
[Route("")] | |
public ResourceState GetAll() | |
{ | |
var maker = Request.TryGetUriMakerFor<ResourceController>(); | |
return new ResourceState | |
{ | |
self = maker.UriFor(c => c.GetAll()), | |
next = maker.UriFor(c => c.GetPaged(1, 10)), | |
first = maker.UriFor(c => c.GetById(0)), | |
first_alternative = maker.UriFor(c => c.GetById(0,true)) | |
}; | |
} | |
[Route("")] | |
public void GetPaged(int page, int count) | |
{ | |
throw new NotImplementedException(); | |
} | |
[Route("{id}")] | |
public void GetById(int id) | |
{ | |
throw new NotImplementedException(); | |
} | |
[Route("{id}")] | |
public void GetById(int id, bool detailed) | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class ResourceState | |
{ | |
public Uri self { get; set; } | |
public Uri next { get; set; } | |
public Uri first { get; set; } | |
public Uri first_alternative { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment