Exemplo n.º 1
0
        public async Task <PartialViewResult> OnGetViewAllPartial()
        {
            Customers = await _customer.GetAllAsync();

            return(new PartialViewResult
            {
                ViewName = "_ViewAll",
                ViewData = new ViewDataDictionary <IEnumerable <Customer> >(ViewData, Customers)
            });
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var customers = await _customerRepository.GetAllAsync();

                return(Ok(customers));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }