Thursday, July 25, 2019

Web Api Route

1. Route with passing id parameter


[RoutePrefix("api/books")] public class BooksController : ApiController
{
// GET /api/authors/1/books [Route("~/api/authors/{Id}/books")] public IEnumerable<Book> GetByAuthor(int authorId) { ... }
// ... }

2. Route with passing id parameter int type

// GET /api/authors/1/books [Route("~/api/authors/{Id:int}/books")] public IEnumerable<Book> GetByAuthor(int authorId) { ... }

3. Route With Passing parameter min 1 value or none of zero Constraint

[Route("users/{id:int:min(1)}")] public User GetUserById(int id) { ... }

No comments:

Post a Comment

Convert 1.25x speed spent hours convert into normal (1x) speed spent hours

If I run a video with 1.25x or 125% speed till 1 hour 26 minuts, then normal hours will be ?   1 hours 26 minuts convert into hours Total 60...