public IActionResult Insert( [FromBody] InfracaoInsertCommand command, [FromServices] InfracaoService service ) { GenericResult result = service.Exec(command); return(StatusCode(result.Status, result)); }
public IActionResult Update( [FromBody] InfracaoUpdateCommand command, [FromServices] InfracaoService service, [FromServices] IMemoryCache cache ) { GenericResult result = service.Exec(command); if (result.Status == 200) { cache.Remove(command.Id); } return(StatusCode(result.Status, result)); }
public IActionResult Delete( int id, [FromServices] InfracaoService service, [FromServices] IMemoryCache cache ) { InfracaoDeleteCommand command = new InfracaoDeleteCommand(id); GenericResult result = service.Exec(command); if (result.Status == 204) { cache.Remove(id); } return(StatusCode(result.Status, result)); }