public void GetAllContacts_ReturnsAllContacts_WhenCalled()
        {
            var moqContactsRepository = new Mock <IContactsRepository>();
            var service  = new ContactsService(moqContactsRepository.Object);
            var contacts = new List <Contact>();

            moqContactsRepository.Setup(r => r.GetAllContacts()).Returns(contacts);

            var result = service.GetAllContacts();

            Assert.That(result, Is.EqualTo(contacts));
        }
 public ActionResult <string> GetAllContacts()
 {
     try
     {
         return(JsonConvert.SerializeObject(_contactsMngr.GetAllContacts()));
     }
     catch (Exception ex)
     {
         ex.HandleException();
         return("Could not find any contacts for this query");
     }
 }
        //public ContactsController(IContactInfo contact)
        //{
        //    _contacts = contact;
        //}
        public IActionResult Index()
        {
            _service = new ContactsService();
            var contactModels = _service.GetAllContacts();
            var listingResult = contactModels
                                .Select(result => new ContactsListingModel
            {
                Id        = result.Id,
                FirstName = result.FirstName,
                LastName  = result.LastName,
                Mobile    = result.Mobile,
                Email     = result.Email,
                ImageURL  = result.ImageURL
            });
            var model = new ContactsIndexModel()
            {
                Contacts = listingResult
            };

            return(View(model));
        }
        public IHttpActionResult Get()
        {
            var contacts = contactsService.GetAllContacts();

            return(Ok(contacts));
        }
 public IHttpActionResult GetContactsTable()
 {
     return(Ok(_contactsService.GetAllContacts()));
 }
        public IActionResult GetContacts()
        {
            var contacts = _contactsService.GetAllContacts();

            return(Ok(new { contacts }));
        }