public async Task <BusPassPayment> createPayment(BusPassPayment payment) { payment.YearId = await _repo.getCurrentYearId(); payment.MonthId = await getCurrMonthId(); if (await _repo.checkPassportForCurrentMonth(payment.BusPassportId, payment.MonthId, payment.YearId) == null) { int userId = await _busPassRepo.getUserIdFromPassport(payment.BusPassportId); Account acc = await _accRepo.GetAccount(userId); if (await _accRepo.checkIfEnoughBalance(acc.AccountId, payment.Price)) { await _accRepo.substructFromBalance(acc.AccountId, payment.Price); payment.DateOfPayment = DateTime.Now; return(await _repo.createPayment(payment)); } else { return(null); } } else { return(null); } }