Exemplo n.º 1
0
        protected void btnSent_Click(object sender, EventArgs e)
        {
            var name    = FullName.Text.ToString();
            var address = Address.Text.ToString();
            var email   = Email.Text.ToString();
            var phone   = Phone.Text.ToString();
            var opinion = Opinion.Text.ToString();

            if (name.StringIsNullEmptyWhiteSpace())
            {
                Notification.Text = "Please input full name";
            }
            else if (address.StringIsNullEmptyWhiteSpace())
            {
                Notification.Text = "Please input address";
            }
            else if (email.StringIsNullEmptyWhiteSpace())
            {
                Notification.Text = "Please input email";
            }
            else if (phone.StringIsNullEmptyWhiteSpace())
            {
                Notification.Text = "Please input phone";
            }
            else if (opinion.StringIsNullEmptyWhiteSpace())
            {
                Notification.Text = "Please input opinion";
            }
            else
            {
                var contact = new WebFormLogin.DataAccess.Models.Contact();
                contact.FullName = name;
                contact.Address  = address;
                contact.Email    = email;
                contact.Phone    = phone;
                contact.Opinion  = opinion;
                var model = contactService.AddContact(contact);
                if (model.IsNull())
                {
                    Notification.Text = "Please try again";
                }
                else
                {
                    NotificationSuccess.Text = "Sent success";
                    ClearFields(Form.Controls);
                }
            }
        }
Exemplo n.º 2
0
 public WebFormLogin.DataAccess.Models.Contact AddContact(WebFormLogin.DataAccess.Models.Contact contact)
 {
     return(contactRepository.Insert(contact));
 }