public IActionResult Create(Income income) { if (ModelState.IsValid) { _incomeRepository.CreateIncome(income); Accountancy accountancy = new Accountancy(); _accountancyRepository.CreateOrEditIncome(accountancy); } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create(IncomeViewModel incomeViewModel) { if (ModelState.IsValid) { var accessToken = await HttpContext.GetTokenAsync("access_token"); IncomeJsonModel income = _mapper.Map <IncomeViewModel, IncomeJsonModel>(incomeViewModel); income.CashAccount_Id = CashAccount_Id; var result = await _incomeRepository.CreateIncome( "https://localhost:44382/Income/Create", accessToken, income); if (result.IsSuccessStatusCode) { return(RedirectToAction("Index", "Income", income.CashAccount_Id)); } } return(View(incomeViewModel)); }