예제 #1
0
        public async Task <IActionResult> GetCustomer()
        {
            List <CustomerDTO> customerDTO;

            try
            {
                customerDTO = await _customerFacade.GetCustomer();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(base.Ok(customerDTO));
        }
예제 #2
0
        /*[Authorize]*/
        public async Task <IActionResult> Details(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            CustomerDto customer = null;

            try
            {
                customer = await _customerFacade.GetCustomer(1);
            }
            catch (HttpRequestException)
            {
                _logger.LogWarning("Exception Occured using Customer Facade");
                customer = null;
            }

            var viewModel = new CustomerViewModel
            {
                CustomerId      = customer.CustomerId,
                GivenName       = customer.GivenName,
                FamilyName      = customer.FamilyName,
                AddressOne      = customer.AddressOne,
                AddressTwo      = customer.AddressTwo,
                Town            = customer.Town,
                State           = customer.State,
                AreaCode        = customer.AreaCode,
                Country         = customer.Country,
                EmailAddress    = customer.EmailAddress,
                TelephoneNumber = customer.TelephoneNumber
            };

            return(View(viewModel));
        }
 // GET: api/Customer/5
 public async Task <CustomerDto> Get(int id)
 {
     return(await _customerFacade.GetCustomer(id));
 }