Exemple #1
0
        public OneResult <ContactViewModel> GetContactByLogin(string login)
        {
            OneResult <ContactViewModel> resultContact = new OneResult <ContactViewModel>();

            try
            {
                Contact contact = _contactService.FindContactByLogin(login);
                resultContact.Ob      = ToViewModel.ToContactViewModel(contact);
                resultContact.Success = true;
            }
            catch (Exception ex)
            {
                resultContact.Success = false;
                resultContact.Message = ex.Message + " " + ex.StackTrace;
            }
            return(resultContact);
        }
Exemple #2
0
        public OneResult <ContactViewModel> Get(int id)
        {
            OneResult <ContactViewModel> resultContact = new OneResult <ContactViewModel>();

            try
            {
                ContactViewModel contactView = ToViewModel.ToContactViewModel(_contactService.GetContact(id));
                resultContact.Ob      = contactView;
                resultContact.Success = true;
            }
            catch (Exception ex)
            {
                //TODO log
                resultContact.Success = false;
                resultContact.Message = ex.Message + ex.StackTrace;
            }
            return(resultContact);
        }