Esempio n. 1
0
        public AddContactResponse Post_AddContact([FromBody] Models.Contact mContact)
        {
            IContactBS bs = DIFactoryDesigntime.GetInstance <IContactBS>();
            IBaseConverter <Models.Contact, Entities.Contact> convtResult = new AutoMapConverter <Models.Contact, Entities.Contact>();

            Entities.Contact eContact = convtResult.ConvertObject(mContact);
            bs.AddContact(eContact);

            var addContactResponse = new AddContactResponse()
            {
                ContactID = eContact.ContactID
            };

            return(addContactResponse);
        }
Esempio n. 2
0
        public AddContactsResponse Post_AddContacts([FromBody] List <Models.Contact> mContactList)
        {
            var        contactIdList = new List <int>();
            IContactBS bs            = DIFactoryDesigntime.GetInstance <IContactBS>();

            foreach (var mContact in mContactList)
            {
                IBaseConverter <Models.Contact, Entities.Contact> convtResult = new AutoMapConverter <Models.Contact, Entities.Contact>();
                Entities.Contact eContact = convtResult.ConvertObject(mContact);
                bs.AddContact(eContact);
                contactIdList.Add(eContact.ContactID);
            }
            var resp = new AddContactsResponse();

            resp.ContactIdList = contactIdList;
            return(resp);
        }