Пример #1
0
        public async Task <IActionResult> DeletePhone(string number)
        {
            var exist = await _phone.PhoneExist(number);


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

            var phoneFound = await _phone.FindPhone(number);

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

            await _phone.DeletePhone(number);

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

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


            return(Ok());
        }
Пример #2
0
        public async Task <ActionResult <PersonDto> > FindByPhone(string phone)
        {
            var exist = await _phone.PhoneExist(phone);

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

            Phone firstNumber = await _phone.FindPhone(phone);

            var personID = firstNumber.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));
        }