Exemple #1
0
        public async Task <Response <CustomerDTO> > GetAsync(int?Id)
        {
            var response = new Response <CustomerDTO>();

            try
            {
                var clase = await _CustomersDomain.GetAsync(Id);

                response.Data = _mapper.Map <CustomerDTO>(clase);
                if (response.Data != null)
                {
                    response.IsSuccess = true;
                    response.Message   = "Consulta Exitosa!";
                }
                else
                {
                    response.IsSuccess = false;
                    response.Message   = "Ha ocurrido un inconveniente al consultar los registros.";
                }
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }

            return(response);
        }
Exemple #2
0
        public async Task <Response <CustomerDTO> > GetAsync(string customerId)
        {
            var response = new Response <CustomerDTO>();

            try
            {
                var customer = await customerDomain.GetAsync(customerId);

                response.Data = mapper.Map <CustomerDTO>(customer);
                if (response.Data != null)
                {
                    response.IsSuccess = true;
                    response.Message   = "Registro exitoso";
                }
            }
            catch (Exception e)
            {
                response.Message = e.Message;
            }
            return(response);
        }
        public async Task <Response <CustomerDTO> > GetAsync(string dni)
        {
            var response = new Response <CustomerDTO>();

            try
            {
                var customer = await domain.GetAsync(dni);

                response.Data = mapper.Map <CustomerDTO>(customer);

                if (response.Data != null)
                {
                    response.IsSuccess = true;
                    response.Message   = "Consulta exitosa";
                }
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }

            return(response);
        }