Exemple #1
0
        public bool AddContactDetails([FromBody] Contact model)
        {
            string      con     = ConfigurationManager.ConnectionStrings["myConnectionString"].ToString();
            ContactData dal     = new ContactData(con);
            Contact     contact = new Contact();

            if (model != null)
            {
                try
                {
                    contact.FirstName    = model.FirstName;
                    contact.LastName     = model.LastName;
                    contact.Email        = model.Email;
                    contact.PhoneNumber  = model.PhoneNumber;
                    contact.AddressLine1 = model.AddressLine1;
                    contact.AddressLine2 = model.AddressLine2;
                    contact.City         = model.City;
                    contact.PinCode      = model.PinCode;
                    contact.State        = model.State;
                    contact.Country      = model.Country;
                    contact.Status       = model.Status;
                    dal.AddContact(contact);
                    return(true);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(false);
        }