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()); }
public ActionResult SyncContacts() { var model = new SyncContacts() { ContactList = GetContactList(false).Take(10).ToList(), ContactModeList = Utility.ContactMode(), }; return(View(model)); }