public int InsertContact(Contact contact)
        {
            var currentTran = Transaction.Current;

            this.contactRepository.Add(contact);
            this.unitOfWork.Commit();

            return contact.ContactId;
        }
Esempio n. 2
0
        public void AddContactTest()
        {
            var contact = new Contact { ContactId=0, Age=28, Address="江西省瑞昌市横立山乡青领村上邹12组" , Mobile="15313150410", Name="邹大侠", Sex=false};

            var res= this.contact.InsertContact(contact);

            AutoMapper.Mapper.CreateMap<Contact, Person>().ForMember(dest => dest.PersonId, options => options.MapFrom(source => source.ContactId));

            var personmap = AutoMapper.Mapper.Map<Person>(contact);
            Assert.IsTrue(res>0);
        }