Ejemplo n.º 1
0
        public async Task <ActionResult <CSVPhonesDto> > CSV()
        {
            var userEmail = User.FindFirst(System.Security.Claims.ClaimTypes.Email).Value;

            if (userEmail != "*****@*****.**")
            {
                return(BadRequest("Not an admin"));
            }

            var phones = await _phone.GetAllNumbers();

            var result = new List <CSVPhonesDto>();

            foreach (var item in phones)
            {
                var temp = new CSVPhonesDto();
                temp.Name  = item.Name;
                temp.Phone = item.Number;
                result.Add(temp);
            }



            return(Ok(result));
        }