Example #1
0
        public ActionResult <ErrorLogViewModel> Delete(Guid id)
        {
            var log = _errorLogAppService.Find(e => e.Id == id);

            if (log.Count > 0)
            {
                _errorLogAppService.Remove(id);
                return(Ok("Log de erro deletado com sucesso"));
            }
            return(NotFound("Log de erro não encontrado para o Id " + id));
        }
Example #2
0
        public CentralDeErrosQuery(IErrorLogAppService errorLogAppService)
        {
            Field <ListGraphType <ErrorLogType> >(
                "errorlogs",
                arguments: new QueryArguments(new List <QueryArgument>
            {
                new QueryArgument <BooleanGraphType>
                {
                    Name = "onlyNotArchieved"
                },
                new QueryArgument <OrderType> {
                    Name = "order"
                }
            }),
                resolve: context =>
            {
                var user             = (ClaimsPrincipal)context.UserContext;
                var onlyNotArchieved = context.GetArgument <bool?>("onlyNotArchieved");
                var order            = context.GetArgument <OrderEnum.Order?>("order");

                if (onlyNotArchieved.HasValue)
                {
                    return(errorLogAppService.Find(p => !p.Archieved));
                }

                return(errorLogAppService.GetAll());
            }
                );
        }