public async Task GetContacts(IGetContactsCallback callback, ContactsQueryParameters queryParams)
        {
            try
            {
                ContactList response = await _api.GetContacts(queryParams);

                ContactListViewModel contactList = new ContactListViewModel(response);

                callback.OnContactsLoaded(contactList);
            }
            catch (ApiException e)
            {
                if (e.StatusCode == HttpStatusCode.NotFound)
                {
                    callback.OnContactsLoaded(new ContactListViewModel( ));
                }
                else
                {
                    callback.OnDataNotAvailable( );
                }
            }
        }
Пример #2
0
 public async Task GetContacts(IGetContactsCallback callback, ContactsQueryParameters queryParams)
 {
     await _contactsApiDataSource.GetContacts(callback, queryParams);
 }
Пример #3
0
 public ContactsPresenter(IContactsDataSource contactsRepository, IContactsView contactsView, IGetContactsCallback contactsViewCallback)
     : base(contactsView)
 {
     _contactsRepository   = contactsRepository;
     _contactsViewCallback = contactsViewCallback;
 }