示例#1
0
class ContactUsController(BaseController):
    def __init__(self):
        self.dbConnection = DBOperations()

    def insertContactUsDetails(self, contactUsDetails):
        from utility.utilities import validateEmail, validatePhoneNumber, generateUniqueId
        # isEmailValidated = validateEmail(contactUsDetails.get('email'))
        # isPhoneValidated = validatePhoneNumber(contactUsDetails.get('phone'))
        from models.models import ContactUs
        contactUsModel = ContactUs(str(generateUniqueId()),
                                   contactUsDetails.get('name'),
                                   contactUsDetails.get('email'),
                                   contactUsDetails.get('phone'))
        return self.dbConnection.insertContactUsDetails(contactUsModel)
示例#2
0
class ContactUsController(BaseController):
    def __init__(self):
        self.dbConnection = DBOperations()

    def insertContactUsDetails(self, contactUsDetails):
        from utility.utilities import validateEmail, validatePhoneNumber, generateUniqueId
        isEmailValidated = validateEmail(contactUsDetails.get('email'))
        # isPhoneValidated = validatePhoneNumber(contactUsDetails.get('phone'))
        if isEmailValidated:
            from models.models import ContactUs
            contactUsModel = ContactUs(str(generateUniqueId()),
                                       contactUsDetails.get('name'),
                                       contactUsDetails.get('email'),
                                       contactUsDetails.get('phone'))
            return self.dbConnection.insertContactUsDetails(contactUsModel)
        else:
            return ExceptionTransformers().transformExceptionContactUs(
                Constants.INVALID_INPUT, Constants.INVALID_EMAIL,
                Constants.STATUS_FAILED)