示例#1
0
        public void CanAddAndRemoveContacts()
        {
            var repo = new AccountRepositoryADO();

            repo.AddContact("11111111-1111-1111-1111-111111111111", 5);
            var contacts = repo.GetContacts(Guid.Empty.ToString());

            Assert.AreEqual(3, contacts.Count());
            repo.RemoveContact("11111111-1111-1111-1111-111111111111", 3);
            contacts = repo.GetContacts(Guid.Empty.ToString());

            Assert.AreEqual(2, contacts.Count());
        }
示例#2
0
        public IHttpActionResult RemoveContact(string userId, int listingId)
        {
            var repo = new AccountRepositoryADO();

            try
            {
                repo.RemoveContact(userId, listingId);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }