Exemplo n.º 1
0
        public ListResult <ContactVM> FindByLastName(string lastName)
        {
            ListResult <ContactVM> contacts = new ListResult <ContactVM>();

            try
            {
                var persons = personDao.FindByLastName(lastName);
                if (persons != null)
                {
                    foreach (Person pers in persons)
                    {
                        ContactVM contact = ConverterPersonToContact.ForAllView(pers);
                        contacts.ListData.Add(contact);
                    }
                    contacts.IsOk    = true;
                    contacts.Message = Resource.FindContactSuccess;
                }
                else
                {
                    contacts.IsOk    = false;
                    contacts.Message = Resource.FindNone;
                }
            }
            catch (Exception ex)
            {
                //TO DO logging
                contacts.IsOk    = false;
                contacts.Message = Resource.FindContactFail;
            }
            return(contacts);
        }
Exemplo n.º 2
0
        public ListResult <ContactVM> GetAllFavoriteContacts(int contactId)
        {
            ListResult <ContactVM> contacts = new ListResult <ContactVM>();

            try
            {
                var quicklist = quicklistDao.GetById(contactId);
                if (quicklist != null && quicklist.Persons != null)
                {
                    foreach (Person pers in quicklist.Persons)
                    {
                        ContactVM contact = ConverterPersonToContact.ForAllView(pers);
                        contacts.ListData.Add(contact);
                    }
                    contacts.IsOk    = true;
                    contacts.Message = Resource.GetAllSuccess;
                }
                else
                {
                    contacts.IsOk    = true;
                    contacts.Message = Resource.QuicklistEmpty;
                }
            }
            catch (Exception)
            {
                //TO DO logging
                contacts.IsOk    = false;
                contacts.Message = Resource.QuicklistError;
            }
            return(contacts);
        }
Exemplo n.º 3
0
        public ListResult <ContactVM> GetAllContacts()
        {
            ListResult <ContactVM> contacts = new ListResult <ContactVM>();

            try
            {
                var persons = personDao.GetAll();
                if (persons != null)
                {
                    foreach (Person pers in persons)
                    {
                        ContactVM contact = ConverterPersonToContact.ForAllView(pers);
                        contacts.ListData.Add(contact);
                    }
                    contacts.IsOk    = true;
                    contacts.Message = Resource.GetAllSuccess;
                }
                else
                {
                    contacts.IsOk    = false;
                    contacts.Message = Resource.GetAllNone;
                }
            }
            catch (Exception)
            {
                //TO DO logging
                contacts.IsOk    = false;
                contacts.Message = Resource.GetAllContactFail;
            }
            return(contacts);
        }