public async Task <object> Delete(Guid contactId, Guid id) { _logger.LogInformation($"delete.phone contact: {id} record: {id}"); AssertValidIds(contactId, id); var resp = await _repository.DeleteAsync(contactId, id); _logger.LogInformation($"deleted.phone contact: {id} record: {id} resp: {resp}"); return(new { Message = "Deleted Phone" }); }
public async Task <IServiceResult> DeleteAsync(Guid uuid) { try { await _phoneRepository.DeleteAsync(uuid); return(new SuccessResult()); } catch (Exception e) { _logger.LogError(e, "Error while deleting"); return(new FailResult()); } }
public async Task <IServiceResult> DeleteAsync(Guid uuid) { try { var phonesUuids = await _phoneRepository.GetUuidsFromCustomer(uuid); foreach (var phoneUuid in phonesUuids) { await _phoneRepository.DeleteAsync(phoneUuid); } await _customerRepository.DeleteAsync(uuid); return(new SuccessResult()); } catch (Exception e) { _logger.LogError(e, "Error while deleting"); return(new FailResult()); } }