16.0: Http Methods
Add IHttpActionResult for all CRUD Endpoints
IHttpActionResult for all CRUD Endpoints namespace ElevenNote.WebAPI.Controllers
{
[Authorize]
public class NoteController : ApiController
{
public IHttpActionResult GetAll()
{
NoteService noteService = CreateNoteService();
var notes = noteService.GetNotes();
return Ok(notes);
}
public IHttpActionResult Get(int id)
{
return Ok();
}
public IHttpActionResult Post(NoteCreate note)
{
return Ok();
}
public IHttpActionResult Put(NoteEdit note)
{
return Ok();
}
public IHttpActionResult Delete(int id)
{
return Ok();
}
private NoteService CreateNoteService()
{
var userId = Guid.Parse(User.Identity.GetUserId());
var noteService = new NoteService(userId);
return noteService;
}
}
}Get Method
Post Method
Put Method
Delete Method

Last updated