コード例 #1
0
        public async Task <PartnerResponse> DeleteAsync(int id)
        {
            var existingPartner = await _partnerRepository.FindById(id);

            if (existingPartner == null)
            {
                return(new PartnerResponse("Partner not found"));
            }
            try
            {
                _partnerRepository.Remove(existingPartner);
                await _unitOfWork.CompleteAsync();

                return(new PartnerResponse(existingPartner));
            }
            catch (Exception ex)
            {
                return(new PartnerResponse($"An error ocurred while deleting Partner {ex.Message}"));
            }
        }