public async Task <IActionResult> CreateIncidentAsync([FromBody] IncidentDto input, [FromServices] IIncidentService incidentService)
    {
        // Map.
        var incident = _mapper.Map <Incident>(input);

        // Act.
        await incidentService.AddAsync(incident);

        // Return.
        return(NoContent());
    }
Esempio n. 2
0
    public async Task <IActionResult> CreateAsync([FromBody] IncidentDto input, [FromServices] IIncidentService incidentService)
    {
        // Map.
        var incident = _mapper.Map <Incident>(input);

        // FUTURE: Remove the meta object.
        // Act.
        incident = await incidentService.AddAsync(incident, new
        {
            SessionUser         = _appContext.UserId,
            SessionOrganization = _appContext.TenantId,
        });

        // Map.
        var output = _mapper.Map <IncidentDto>(incident);

        // Return.
        return(Ok(output));
    }