示例#1
0
        public async Task <string> DeletePhoneNumberAsync(int personId, string number, int phoneNumberTypeId)
        {
            if (!string.IsNullOrEmpty(number))
            {
                var listPersonPhone = await _personPhoneRepository.FindAllAsync();

                var personPhone = listPersonPhone.SingleOrDefault(x => x.BusinessEntityID == personId && x.PhoneNumber == number && x.PhoneNumberTypeID == phoneNumberTypeId);
                if (personPhone != null)
                {
                    var result = await _personPhoneRepository.DeleteAsync(personPhone);

                    if (result)
                    {
                        return("Successfully delete");
                    }
                    else
                    {
                        return("Error, try again!");
                    }
                }
                else
                {
                    return("Register not found!");
                }
            }
            else
            {
                return("Number field cannot be empty!");
            }
        }
示例#2
0
 public async Task DeleteAsync(PersonPhone personPhone) => await _personPhoneRepository.DeleteAsync(personPhone);