public IActionResult GetCustomers()
 {
     try
     {
         return(Ok(_customersLogic.GetAll()));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
예제 #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());
            }
        }
예제 #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}"));
            }
        }
예제 #4
0
 public IEnumerable <Customer> Get()
 {
     return(_customerLogic.GetAll());
 }