예제 #1
0
        public int AddContact(Contact objContact)
        {
            int id;

            try
            {
                id = cDAL.AddContact(objContact);
                return(id);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// Add Contact
        /// </summary>
        /// <param name="contactRequest">contactRequest</param>
        /// <returns>Returns true if addition is successful else false</returns>
        public async Task <bool> AddContact(ContactRequest contactRequest)
        {
            ContactValidator contactValidator = new ContactValidator(eHIDemoContext);

            contactValidator.ValidateContactRequest(contactRequest);

            ContactDAL contactDAL = new ContactDAL(eHIDemoContext);

            DBModel.Contact.Contact contact = ContactMapper.MapperForContactAdd(contactRequest);
            int savedRecordCount            = await contactDAL.AddContact(contact).ConfigureAwait(false);

            if (savedRecordCount > 0)
            {
                return(true);
            }
            return(false);
        }
예제 #3
0
 public int AddContact([FromBody] Contact c)
 {
     return(_contactDAL.AddContact(c));
 }