|
|
|
@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Authorization; |
|
|
|
|
using IO.Swagger.DTO; |
|
|
|
|
using EPAServeur.Services; |
|
|
|
|
using EPAServeur.IServices; |
|
|
|
|
using EPAServeur.Models.Notes; |
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
|
{ |
|
|
|
@ -53,16 +54,18 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult DeleteNote([FromRoute][Required]int? idNote) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 204 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(204); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(404, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
if(!noteService.SupprimerNote(idNote)) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune note trouvé" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
}; |
|
|
|
|
return NoContent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -223,14 +226,11 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerOperation("NouvelleNote")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult NouvelleNote([FromBody]DetailsNoteDTO body) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(201); |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
Note nouvelleNote = noteService.AjouterNote(body); |
|
|
|
|
return Created("",nouvelleNote); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -249,17 +249,16 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[SwaggerOperation("UpdateNote")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult UpdateNote([FromBody]DetailsNoteDTO body, [FromRoute][Required]int? idNote) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(201); |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
Note note = noteService.UpdateNote(idNote, body); |
|
|
|
|
if (note == null) |
|
|
|
|
note = noteService.AjouterNote(body); |
|
|
|
|
return Ok(note); |
|
|
|
|
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(201); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|