public async Task <bool> AddOrUpdateFeeAsync(CourtRentFee Fee) { var dbCourtRentFee = await _courtRentFeeRepository.GetAsync(Fee.Id); var success = true; if (!Fee.IsCurrent) { _logger.LogError($"New Add/Update fee must be current (Set IsCurrent flag as true) for basketball centre {Fee.CentreId}"); return(false); } success &= await UpdateAllAsPassedFee(Fee.CentreId); if (dbCourtRentFee == null) { // add return(success && !(await _courtRentFeeRepository.CreateAsync(Fee) is null)); } else { return(await _courtRentFeeRepository.UpdateAsync(Fee.Id, Fee)); } }
public async Task <ActionResult <bool> > PostCourtRentFee(CourtRentFee courtRentFee) { return(await _courtRentFeeManager.AddOrUpdateFeeAsync(courtRentFee)); }