Ejemplo n.º 1
0
        public async Task <EditContactResponse> EditContact(EditContactRequest editContactRequest)
        {
            this.logger.LogInfoMessage(this.GetType(), "Begin EditContact");

            EditContactResponse editContactResponse = new EditContactResponse();

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

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

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

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

            return(editContactResponse);
        }
Ejemplo n.º 2
0
        public async Task <EditContactResponse> EditContact(EditContactRequest editContactRequest)
        {
            this.logger.LogInfoMessage(this.GetType(), "Begin EditContact");
            EditContactResponse editContactResponse = new EditContactResponse();

            this.CheckInVariants(editContactRequest, editContactResponse);

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

            if (editContactResponse.ReturnValueInt == 0)
            {
                try
                {
                    Task <EditContactResponse> task = this.core.EditContact(editContactRequest);
                    await task;

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

            if (editContactResponse.ReturnValueInt == 0)
            {
                editContactResponse.Success("Contact Edited Successfully.");
            }

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

            return(editContactResponse);
        }