Example #1
0
        public FileContentResult ExportList(int?id)
        {
            var generatedList = dbNew.RetrieveLists.Find(id);

            if (generatedList != null)
            {
                var contacts  = PlatformHelper.GetContactsByIds(dbNew, generatedList.ContactsIds.Split(','));
                var csvString = PlatformHelper.GenerateCSVString(contacts);
                var fileName  = generatedList.Name + " " + DateTime.UtcNow.ToString() + ".csv";
                return(File(new System.Text.UTF8Encoding().GetBytes(csvString), "text/csv", fileName));
            }

            return(null);
        }