public Task RemoveEntryAsync(PhoneEntry entry) { if (_phoneEntryRepository.FindAsync(entry.PhoneNumber).GetAwaiter().GetResult() == null) { throw new ArgumentException(); } return(_phoneEntryRepository.RemoveAsync(entry)); }
/// <summary> /// /// </summary> /// <param name="phoneEntry"></param> /// <returns></returns> /// <exception cref="ArgumentNullException">Input parameters are null</exception> public Task AddAsync(PhoneEntry phoneEntry) { if (phoneEntry == null) { throw new ArgumentNullException(nameof(phoneEntry)); } _phones.Add(phoneEntry); return(Task.FromResult(0)); }
/// <summary> /// /// </summary> /// <param name="phoneEntry"></param> /// <returns></returns> /// <exception cref="ArgumentNullException">Input parameters are null</exception> public Task RemoveAsync(PhoneEntry phoneEntry) { if (phoneEntry == null) { throw new ArgumentNullException(nameof(phoneEntry)); } var phoneToRemove = _phones.FirstOrDefault(x => x.PhoneNumber == phoneEntry.PhoneNumber); if (phoneToRemove != null) { _phones.Remove(phoneToRemove); } return(Task.FromResult(0)); }