public async Task <bool> RemoveWhereAsync(int changeId, int rowId) { var rowChange = await RepoDbSet .FirstOrDefaultAsync(change => change.ChangeId == changeId && change.ReceiptRowId == rowId); if (rowChange == null) { return(false); } RepoDbSet.Remove(rowChange); return(true); }
public async Task <int> FindOrAddAsync(DALReceiptParticipantDTO participant, int receiptManagerId) { var loan = await RepoDbSet .FirstOrDefaultAsync(obj => obj.ReceiptParticipantId == participant.Id); if (loan != null) { return(loan.Id); } return((await RepoDbSet.AddAsync(new Loan() { ReceiptParticipantId = participant.Id, LoanTakerId = participant.ParticipantAppUserId, LoanGiverId = receiptManagerId })).Entity.Id); }
public async Task <DALReceiptParticipantDTO> FindOrAddAsync(int receiptId, int loanTakerId) { var participant = await RepoDbSet .FirstOrDefaultAsync(obj => obj.AppUserId == loanTakerId && obj.ReceiptId == receiptId); if (participant != null) { return(ReceiptParticipantMapper.FromDomain(participant)); } participant = (await RepoDbSet.AddAsync(new ReceiptParticipant { AppUserId = loanTakerId, ReceiptId = receiptId })).Entity; return(ReceiptParticipantMapper.FromDomain(participant));; }