public async Task <Spending> Add(Spending entity) { try { if (entity != null) { _context.Add(entity); await _context.SaveChangesAsync(); if (await _balanceRepo.CalculateAndSave(await GetParentBalance(entity.Id)) != null) { return(entity); } return(null); } return(null); } catch (Exception) { throw null; } }
public async Task <Income> Add(Income income) { try { if (income != null) { _context.Add(income); await _context.SaveChangesAsync(); if (await _balanceRepo.CalculateAndSave(await GetParentBalance(income.Id)) != null) { return(income); } return(null); } return(null); } catch (Exception) { throw null; } }