Beispiel #1
0
        public void Test1()
        {
            CreateService();

            var idUser = "";

            var compaigns = _ISendMail.GetCompaigns(idUser);
            //Assert.True(compaigns > 0, "The value greater than 0");
        }
        public IActionResult Post([FromBody] User user)
        {
            var lista = _ISendMail.GetCompaigns(user.IdUser);

            var json = JsonConvert.SerializeObject(lista);

            //Invocamos la libreria que se encarga de gestionar la data para exportar a excel
            byte[] fileContents = _IExportExcel.ToBytes(json.ToString());
            if (fileContents == null || fileContents.Length == 0)
            {
                return(NotFound());
            }
            return(File(
                       fileContents: fileContents,
                       contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                       fileDownloadName: "sendmails.xlsx"
                       ));
        }