Beispiel #1
0
        public async Task <IActionResult> DeletePhone(string email)
        {
            var exist = await _email.EmailExist(email);


            if (!exist)
            {
                return(BadRequest("Email not on the database"));
            }

            var emailFound = await _email.FindEmail(email);

            var person = await _person.FindPerson(emailFound.PersonID);

            await _email.DeleteEmail(email);

            var userEmail = User.FindFirst(System.Security.Claims.ClaimTypes.Email).Value;

            await _log.Create(userEmail, "", email, $"EMAIL DELETED - {person.Name} ");


            return(Ok());
        }
Beispiel #2
0
        public async Task <IActionResult> FindByEmail(string email)
        {
            email = email.ToLower();
            var exist = await _email.EmailExist(email);

            if (!exist)
            {
                return(BadRequest("Email not found"));
            }

            Email firstEmail = await _email.FindEmail(email);

            var personID = firstEmail.PersonID;

            var user = await _person.FindPerson(personID);

            var phoneList = await _phone.FindAllUserNumber(personID);

            var EmailList = await _email.FindAllUserEmails(personID);

            var person = new PersonDto(user, phoneList, EmailList);

            return(Ok(person));
        }