// GET: Income/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var income = await _repository.Get((int)id); if (income == null) { return(NotFound()); } return(View(income)); }
public async Task <ActionResult <Income> > GetIncome(int id) { var user = await _repository.ValidUser(GetTokenUserId()); if (user == null) { return(NotFound()); } var income = await _repository.Get(id, user.Id); if (income == null) { return(NotFound()); } return(Ok(income)); }
public void DeleteIncome(Int32 userId, Int32 incomeId) { var income = _incomeRepository.Get(incomeId); if (income != null || income.UserId == userId) { _incomeRepository.Delete(income); } }
public async Task UpdateIncome(string userId, IncomeModel income) { try { UserModel user = await _userRepository.Get(userId); IncomeModel oldIncome = await _incomeRepository.Get(income._id); if (income.Amount != oldIncome.Amount) { user.Wallets.Add(await UpdateWalletForUpdatedIncome(user, income, oldIncome)); } await _incomeRepository.Update(income._id, income); await _userRepository.Update(userId, user); } catch (Exception e) { throw new Exception(); } }
public IncomeQuestionnaire Get(int id) { return(_repository.Get(id)); }
public List <Income> Get() { return(incomeRepository.Get()); }
public Income Get(int id) { return(_incomeRepository.Get(id)); }