public async Task <AddContactResponse> AddContact(AddContactRequest addContactRequest) { this.logger.LogInfoMessage(this.GetType(), "Begin AddContact"); AddContactResponse addContactResponse = new AddContactResponse(); try { ContactData cd = this.ConvertContactMessageToObject(addContactRequest); BaseResponse response = await this.contact.AddContact(cd); addContactResponse.Build(response.ReturnValueInt, response.ReturnValueString, response.ReturnValueCustomString); if (response.ReturnValueCustomObject != null) { addContactResponse.NewContactID = (Int64)response.ReturnValueCustomObject; } } catch (Exception ex) { addContactResponse.RunTimeException(ex, "Exception while adding contact."); this.logger.LogErrorMessage(this.GetType(), "Exception in AddContact", ex); } this.logger.LogInfoMessage(this.GetType(), String.Format("End AddContact:{0}", addContactResponse.ReturnValueInt)); return(addContactResponse); }
public async Task <AddContactResponse> AddContact(AddContactRequest addContactRequest) { this.logger.LogInfoMessage(this.GetType(), "Begin AddContact"); AddContactResponse addContactResponse = new AddContactResponse(); this.CheckInVariants(addContactRequest, addContactResponse); // Validate Request if (addContactResponse.ReturnValueInt == 0) { addContactRequest.Validate(addContactResponse, this.logger); } if (addContactResponse.ReturnValueInt == 0) { try { Task <AddContactResponse> task = this.core.AddContact(addContactRequest); await task; addContactResponse.ReturnValueInt = task.Result.ReturnValueInt; addContactResponse.ReturnValueString = task.Result.ReturnValueString; addContactResponse.ReturnValueCustomString = task.Result.ReturnValueCustomString; addContactResponse.NewContactID = task.Result.NewContactID; } catch (Exception e) { addContactResponse.RunTimeException(e, "Exception while adding contact."); } } if (addContactResponse.ReturnValueInt == 0) { addContactResponse.Success("Contact added Successfully."); } this.logger.LogInfoMessage(this.GetType(), String.Format("End AddContact:{0}", addContactResponse.ReturnValueInt)); return(addContactResponse); }