Beispiel #1
0
        public IActionResult Delete(int id)
        {
            var email = _emailRepository.GetEmailById(id);

            if (email == null)
            {
                return(NotFound());
            }

            _emailRepository.DeleteEmail(id);
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <IActionResult> DeletePerson(string id)
        {
            var exist = await _person.PersonExist(id);


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


            var person = await _person.FindPerson(id);

            await _person.DeletePerson(id);

            var phoneList = await _phone.FindAllUserNumber(id);

            var emailList = await _email.FindAllUserEmails(id);

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


            foreach (var item in phoneList)
            {
                await _phone.DeletePhone(item.Number);

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

            foreach (var item in emailList)
            {
                await _email.DeleteEmail(item.UserEmail);

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



            return(Ok());
        }
Beispiel #3
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());
        }
 public bool DeleteEmail(Email email)
 {
     return(_emailRepository.DeleteEmail(email));
 }
Beispiel #5
0
 public MailResponseDTO DeleteEmail(int idEmail)
 {
     return(_emailRepository.DeleteEmail(idEmail));
 }