Ejemplo n.º 1
0
        public async Task <IHttpActionResult> GetAll()
        {
            try
            {
                if (User.Identity.IsAuthenticated)
                {
                    var sub = (User as ClaimsPrincipal).FindFirst("sub");
                }

                var reportDtos = await _reportService.GetAllAsync();

                if (!reportDtos.Any())
                {
                    return(NotFound());
                }
                var reportShorts = _mapper.Map <IEnumerable <ReportShort> >(reportDtos);

                return(Ok(reportShorts));
            }
            catch (InvalidOperationException ioe)
            {
                return(InternalServerError(ioe));
            }
        }