|
|
@ -1,6 +1,8 @@
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace OSI.API.Controllers
|
|
|
|
namespace OSI.API.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -24,5 +26,30 @@ namespace OSI.API.Controllers
|
|
|
|
// DELETE: api/Clients/5
|
|
|
|
// DELETE: api/Clients/5
|
|
|
|
[HttpDelete("{id}")]
|
|
|
|
[HttpDelete("{id}")]
|
|
|
|
public abstract IActionResult Delete(int id);
|
|
|
|
public abstract IActionResult Delete(int id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected T FromJSON<T>(string input)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
JsonSerializerOptions options = new()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Converters = {
|
|
|
|
|
|
|
|
new JsonStringEnumConverter()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return JsonSerializer.Deserialize<T>(input, options);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected string ToJSON<T>(T input)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
JsonSerializerOptions options = new()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WriteIndented = true,
|
|
|
|
|
|
|
|
Converters = {
|
|
|
|
|
|
|
|
new JsonStringEnumConverter()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return JsonSerializer.Serialize<T>(input, options);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|