using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using ms_lesService.Mapping;
using ms_lesService.Objects;

namespace ms_lesService.Controllers;

/// <summary>
/// Controller for generating web requests related to log sources
/// </summary>
[ApiController]
[Route("/data")]
public class WebController : ControllerBase
{
    /// <summary>
    /// Retrieves a log sources to store them in the database.
    /// </summary>
    [HttpPost]
    public void HandleLogSource([FromBody] List<LogSource> logSources)
    {
        foreach (var les in logSources)
        {
            DatabaseSave.SaveLogSource(les); //Storing in the database
        }
    }
}

