public IActionResult GetCustomers()
 {
     try
     {
         return(Ok(_customersLogic.GetAll()));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #2
0
        public ActionResult <List <CustomerDto> > Get()
        {
            try
            {
                IList <CustomerModel> result = _customerLogic.GetAll();

                if (result.Any())
                {
                    return(Ok(_mapper.MapCollection <CustomerModel, CustomerDto>(result)));
                }

                return(NoContent());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Example #3
0
        public async Task <IActionResult> GetCustomers()
        {
            var location = GetControllerActionNames();

            try
            {
                _logger.LogInfo($"{location}: Attempted Call");
                var customers = await _businessLogic.GetAll();

                var response = _mapper.Map <IList <CustomerDTO> >(customers);
                _logger.LogInfo($"{location}: Successful");
                return(Ok(response));
            }
            catch (Exception e)
            {
                return(InternalError($"{location}: {e.Message} - {e.InnerException}"));
            }
        }
Example #4
0
 public IEnumerable <Customer> Get()
 {
     return(_customerLogic.GetAll());
 }