public IHttpActionResult AnotherExampleGet(int id) { var model = ExampleRepository.GetData(); return(ExampleReturn("body", "v1")); //return BadRequest(); //return NotFound(); //return Ok(model); }
public ExampleApiModel AnotherGet(int id) { var model = ExampleRepository.GetData(); return(new ExampleApiModel() { Id = model.Id, Data = model.Data }); }
// GET api/values/5 - GetData public ExampleApiModel Get(int id) { var model = ExampleRepository.GetData(); var urlHelper = new UrlHelper(Request); //CreateLink(_urlHelper.Link("Example", new {id = 1}), "self"); //CreateLink(_urlHelper.Link("Example", new {id = 2}), "next"); return(new ExampleApiModel() { Id = model.Id, Data = model.Data, Url = urlHelper.Link("Example", new { id }) }); }
// GET api/values/5 - GetData public HttpResponseMessage Get(int id) { var model = ExampleRepository.GetData(); var urlHelper = new UrlHelper(Request); var username = _identityService.GetUser(); if (username == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, new ExampleApiModel { Id = model.Id, Data = username, Url = urlHelper.Link("Example", new { id }) })); }