コード例 #1
0
        public IActionResult GetContactDetail([FromRoute] int id)
        {
            try
            {
                var contactDetails   = _contactInformationRepository.GetContactDetailById(id);
                var contactDetailDTO = new ContactDetailDTO();

                if (contactDetails != null)
                {
                    contactDetailDTO.ContactDetailId = id;
                    contactDetailDTO.FirstName       = contactDetails.FirstName;
                    contactDetailDTO.LastName        = contactDetails.LastName;
                    contactDetailDTO.Email           = contactDetails.Email;
                    contactDetailDTO.PhoneNumber     = contactDetails.PhoneNumber;
                    contactDetailDTO.Status          = contactDetails.Status.ToString();
                }
                return(Ok(contactDetailDTO));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { Message = ex.Message }));
            }
        }