public int AddContact(Contact objContact) { int id; try { id = cDAL.AddContact(objContact); return(id); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <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); }
public int AddContact([FromBody] Contact c) { return(_contactDAL.AddContact(c)); }