Esempio n. 1
0
        public async Task <ActionResult> SyncContacts(SyncContacts model)
        {
            var contacts = new List <ContactDetails>();

            foreach (var item in model.ContactList.Where(x => x.IsSelected))
            {
                contacts.Add(GetContact(item.Id, false));
            }
            if (contacts.Count > default(int))
            {
                var createFile = CreateFile((int)FileType.Pdf, contacts, Server.MapPath(ContactHubConstants.DataPathConstants.TempFilePath)).Result;
                switch (createFile.IsFileCreated)
                {
                case true:
                    var attachmentFilePath = Path.Combine(Server.MapPath(ContactHubConstants.DataPathConstants.TempFilePath), createFile.FileName);
                    var HasMailSent        = await Utility.SynchronizeContacts(new[] { "*****@*****.**" }, Server.MapPath(ContactHubConstants.DataPathConstants.MailingCredential), attachmentFilePath);

                    var HasFileDeleted = await Utility.DeleteFile(attachmentFilePath);

                    break;

                case false: break;

                default: break;
                }
            }
            return(View());
        }
Esempio n. 2
0
        public ActionResult SyncContacts()
        {
            var model = new SyncContacts()
            {
                ContactList     = GetContactList(false).Take(10).ToList(),
                ContactModeList = Utility.ContactMode(),
            };

            return(View(model));
        }