public GetContactByContactIdDataResponse GetContactByContactId(GetContactByContactIdDataRequest request) { GetContactByContactIdDataResponse result = new GetContactByContactIdDataResponse(); if (request == null) { throw new ArgumentNullException("request"); } try { IContactRepository repo = Factory.GetRepository(request, RepositoryType.Contact); if (repo == null) { throw new Exception("The repository should not be null"); } result.Contact = repo.FindByID(request.ContactId) as ContactData; result.Limit = Limit; } catch (Exception ex) { throw ex; } return(result); }
public ContactData GetContactByContactId(GetContactByContactIdRequest request) { ContactData result = null; try { IRestClient client = new JsonServiceClient(); //[Route("/{Context}/{Version}/{ContractNumber}/Contact/{ContactId}", "GET")] var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contact/{4}", DDContactServiceUrl, "NG", request.Version, request.ContractNumber, request.ContactId), request.UserId); GetContactByContactIdDataResponse dataDomainResponse = client.Get <GetContactByContactIdDataResponse>(url); if (dataDomainResponse != null) { result = dataDomainResponse.Contact; } return(result); } catch (Exception ex) { throw ex; } }
public void Get_Contact_By_Id_Response_Test() { double version = 1.0; string contractNumber = "InHealth001"; string context = "NG"; string ContactId = "5325c821072ef705080d3488"; IRestClient client = new JsonServiceClient(); JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", ContactId)); GetContactByContactIdDataResponse response = client.Get <GetContactByContactIdDataResponse>(string.Format("{0}/{1}/{2}/{3}/Contact/{4}/?UserId={5}", "http://localhost:8888/Contact", context, version, contractNumber, ContactId, ContactId)); }
public GetContactByContactIdDataResponse Get(GetContactByContactIdDataRequest request) { GetContactByContactIdDataResponse response = new GetContactByContactIdDataResponse(); response.Version = request.Version; try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ContactDD:Get()::Unauthorized Access"); } response = Manager.GetContactByContactId(request); } catch (Exception ex) { CommonFormat.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }