Example #1
0
        public async Task <IActionResult> GetAllProductsAsync(
            [FromServices] IProductsAppService productsAppService
            )
        {
            var search = await productsAppService.GetAllProductsAsync();

            var data            = _mapper.Map <List <ProductsModelView> >(search);
            var returnModelView = new BaseViewModel <List <ProductsModelView> >
            {
                Mensagem        = data.Count > 0?  messages.PRODUCTS_ALL_SUCCESS(data.Count) : messages.PRODUCTS_ALL_FAIL(),
                Sucesso         = true,
                ObjetoDeRetorno = data
            };

            #region .::Log Requests
            loggerService.SaveLoggerSuccess(new LoggerDomain
            {
                objects = JsonConvert.SerializeObject(returnModelView),
                userId  = UsuarioId
            });
            #endregion

            return(Ok(returnModelView));
        }