Exemplo n.º 1
0
 public void Post([FromBody] FactureDTO factureDTO)
 {
     if (ModelState.IsValid)
     {
         _data.Add(factureDTO.ToFacture());
     }
 }
Exemplo n.º 2
0
 public ActionResult <Invoice> Post([FromBody] Invoice newInvoice)
 {
     if (ModelState.IsValid)
     {
         _data.Add(newInvoice);
         return(Created($"invoices/{newInvoice.Reference}", newInvoice));
     }
     else
     {
         return(BadRequest(ModelState.Values));
     }
 }
Exemplo n.º 3
0
 public ActionResult <Facture> CreateFacture([FromBody] Facture nouvelleFacture)
 {
     if (ModelState.IsValid)
     {
         _data.Add(nouvelleFacture);
         return(nouvelleFacture);
     }
     else
     {
         return(BadRequest("Facture non valide"));
     }
 }
Exemplo n.º 4
0
 public ActionResult <Invoice> CreateInvoice([FromQuery] Invoice newInvoice)
 {
     if (ModelState.IsValid)
     {
         // TODO : Ajouter la nouvelle facture à la collection
         /*return Created($"invoices/{newInvoice.Reference}", newInvoice);*/
         _data.Add(newInvoice);
         return(newInvoice);
     }
     else
     {
         return(BadRequest("Invoice is not valid"));
     }
 }