Ejemplo n.º 1
0
        //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));
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            user = userServices.FindUser(this.User.Identity.Name);
              IList<Contact> contacts = contactServices.GetAllForUser(user.Id);
              IList<ContactsIndexModel> contactsModelList = new List<ContactsIndexModel>();
              ContactsIndexModel contactsModel;

              foreach (Contact c in contacts) {
            contactsModel = new ContactsIndexModel();
            contactsModel.ContactId = c.Id;
            contactsModel.Company = c.Company;
            contactsModel.FirstName = c.FirstName;
            contactsModel.LastName = c.LastName;

            contactsModel.Email = c.Email;
            contactsModel.User = c.User.LoginId;
            contactsModel.tags = getTags(c);
            contactsModelList.Add(contactsModel);
              }

              return View(contactsModelList);
        }