Esempio n. 1
0
        public ActionResult Get()  //<IEnumerable<Command>>
        {
            _telemetryClient.TrackEvent("Logging - in GET (controller) | telemetry");
            _logger.LogInformation("Logging - in GET (controller) | serilog");

            //throw new UnauthorizedAccessException();

            try
            {
                var response = _commander.GetAllCommand();
                if (response == null)
                {
                    return(NotFound());
                }
                var result = _mapper.Mapper.Map <IEnumerable <Command>, IEnumerable <CommandDTO> >(response);
                return(new OkObjectResult(result));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }