|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Shared;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Net;
|
|
|
|
|
|
|
|
|
|
namespace WfApi.Controllers
|
|
|
|
@ -23,7 +24,7 @@ namespace WfApi.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===================================== ROUTE GET =====================================
|
|
|
|
|
[HttpGet("id/{id}")] // Indiquer que l'id est dans l'URL
|
|
|
|
|
[HttpGet("{id}")] // Indiquer que l'id est dans l'URL
|
|
|
|
|
public async Task<IActionResult> GetQuote(int id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
@ -67,5 +68,47 @@ namespace WfApi.Controllers
|
|
|
|
|
return StatusCode((int)HttpStatusCode.InternalServerError, new { message = "Internal Server Error" });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[HttpGet("allbylang")] // Indiquer que l'id est dans l'URL
|
|
|
|
|
public async Task<IActionResult> GetAllQuoteByLang(TypeLangageDTO lang,int index = 0, int count = 10)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var result = _quote.GetAllQuoteLang(index, count,(int)lang);
|
|
|
|
|
|
|
|
|
|
if (result.IsCompletedSuccessfully)
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult<IActionResult>(Ok(result));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return NoContent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return StatusCode((int)HttpStatusCode.InternalServerError, new { message = "Internal Server Error" });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[HttpDelete("delete")]
|
|
|
|
|
public async Task<IActionResult> DeleteQuote([FromQuery] int idQuote)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var result = _quote.RemoveQuote(idQuote);
|
|
|
|
|
|
|
|
|
|
if (result.IsCompletedSuccessfully)
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult<IActionResult>(Ok(result));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return NotFound();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return StatusCode((int)HttpStatusCode.InternalServerError, new { message = "Internal Server Error" });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|