Example #1
0
        public async Task <DeleteContactResponse> DeleteContact(DeleteContactRequest deleteContactRequest)
        {
            this.logger.LogInfoMessage(this.GetType(), "Begin DeleteContact");

            DeleteContactResponse deleteContactResponse = new DeleteContactResponse();

            try
            {
                ContactData cd = this.ConvertContactMessageToObject(deleteContactRequest);

                BaseResponse response = await this.contact.DeleteContact(cd);

                deleteContactResponse.Build(response.ReturnValueInt,
                                            response.ReturnValueString,
                                            response.ReturnValueCustomString);
            }
            catch (Exception ex)
            {
                deleteContactResponse.RunTimeException(ex, "Exception while Deleting contact.");
                this.logger.LogErrorMessage(this.GetType(), "Exception in DeleteContact", ex);
            }

            this.logger.LogInfoMessage(this.GetType(),
                                       String.Format("End DeleteContact:{0}", deleteContactResponse.ReturnValueInt));

            return(deleteContactResponse);
        }
        public async Task <DeleteContactResponse> DeleteContact(DeleteContactRequest deleteContactRequest)
        {
            this.logger.LogInfoMessage(this.GetType(), "Begin DeleteContact");
            DeleteContactResponse deleteContactResponse = new DeleteContactResponse();

            this.CheckInVariants(deleteContactRequest, deleteContactResponse);

            // Validate Request
            if (deleteContactResponse.ReturnValueInt == 0)
            {
                deleteContactRequest.Validate(deleteContactResponse, this.logger);
            }

            if (deleteContactResponse.ReturnValueInt == 0)
            {
                try
                {
                    Task <DeleteContactResponse> task = this.core.DeleteContact(deleteContactRequest);
                    await task;

                    deleteContactResponse.ReturnValueInt          = task.Result.ReturnValueInt;
                    deleteContactResponse.ReturnValueString       = task.Result.ReturnValueString;
                    deleteContactResponse.ReturnValueCustomString = task.Result.ReturnValueCustomString;
                }
                catch (Exception e)
                {
                    deleteContactResponse.RunTimeException(e, "Exception while Deleting contact.");
                }
            }

            if (deleteContactResponse.ReturnValueInt == 0)
            {
                deleteContactResponse.Success("Contact Deleted Successfully.");
            }

            this.logger.LogInfoMessage(this.GetType(),
                                       String.Format("End DeleteContact:{0}", deleteContactResponse.ReturnValueInt));

            return(deleteContactResponse);
        }