Beispiel #1
0
 public bool UpdateContacts(TLClient client, ContactRepository contactRepository)
 {
     try
     {
         contactRepository.DeleteContacts();
         return(GetContacts(client, contactRepository));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public Response <Contacts> DeleteContacts(Contacts contacts)
 {
     try
     {
         var data = _contactRepository.DeleteContacts(contacts);
         if (data != null && data.Any())
         {
             return(new Response <Contacts>(true, "Success", data[0]));
         }
         return(new Response <Contacts>(false, "Fail", null));
     }
     catch (Exception e)
     {
         _logger.Error($"DeleteContacts Failed: {e.Message}\n {e.StackTrace}");
         return(new Response <Contacts>(false, e.Message, null));
     }
 }
        public void DeleteContacts()
        {
            SQLiteRepository con = new SQLiteRepository();

            con.CreateDatabase();
            ContactRepository contactRepository = new ContactRepository(con);
            Contact           contact           = new Contact
            {
                Id        = 1,
                FirstName = "Pablo",
                LastName  = "Corral",
                Phone     = "34676681420",
                Status    = "Offline",
                Blocked   = false
            };

            using (var connection = con.GetConnection())
            {
                contactRepository.InsertContact(contact);
                var result = contactRepository.DeleteContacts();
                var list   = contactRepository.GetContacts();
                Assert.AreEqual(0, list.Count);
            }
        }