Exemple #1
0
        // GET: Agenda
        public ActionResult Index()
        {
            List <AgendaViewModel> model = new List <AgendaViewModel>();

            foreach (ContatoEntitis item in repository.List())
            {
                List <Phone> pho = JsonConvert.DeserializeObject <List <Phone> >(item.Telefone);
                List <Email> ema = JsonConvert.DeserializeObject <List <Email> >(item.Email);

                model.Add(new AgendaViewModel {
                    ID = item.Id, Name = item.Nome, Emails = ema, Empresa = item.Empresa, Phones = pho
                });
            }
            return(View("Index", model));
        }