Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- routes.MapHttpRoute(
- name:"DinnerApplicationApi",
- routeTemplate: "api/dinner/{dinnerId}/{controller}"
- );
- [ModelValidationFilter]
- public HttpResponseMessage Post([FromBody]ApplicationApiModel application, int dinnerId)
- {
- //this will work when invoked from route /dinner/dinnerId/application and without ModelValidationFilter
- application.dinnerId = dinnerId;
- if (123456 == application.dinnerId)
- return new HttpResponseMessage(HttpStatusCode.OK);
- else
- {
- return new HttpResponseMessage(HttpStatusCode.BadRequest);
- }
- }
- public class ApplicationApiModel
- {
- [Required]
- public int DinnerId { get; set; }
- [Required]
- public AttendeeApiModel Attendee { get; set; }
- public string Message { get; set; }
- public string Password { get; set; }
- }
Add Comment
Please, Sign In to add comment