public int InsertContact(Contact contact) { DbContact.Contact contactDB = new DbContact.Contact(); contactDB = AutoMapper.mapper.Map <Contact, DbContact.Contact>(contact); this.DB.Insert(contact); return(contactDB.Id); }
public int UpdateContact(Contact contact) { DbContact.Contact contactDB = new DbContact.Contact(); contactDB = AutoMapper.mapper.Map <Contact, DbContact.Contact>(contact); this.DB.Update(contact); return(contact.Id); }
public Contact GetContactById(int id) { DbContact.Contact contact = this.DB.SingleOrDefault <DbContact.Contact>("select * from Contact where Id = @0", id); return(AutoMapper.mapper.Map <DbContact.Contact, Contact>(contact)); }