public async Task Delete(int id) { IncomeDao incomeDao = new IncomeDao(_context); try { await incomeDao.AddAsync(new Income() { IncomeId = id }); } catch (Exception e) { } return; }
public async Task <IActionResult> Post([FromBody] IncomeViewModel incomeVm) { Income income = new Income(); IncomeDao incomeDao = new IncomeDao(_context); if (!ModelState.IsValid) { return(BadRequest()); } try { income = IncomeViewModelToIncome.Map(incomeVm); income.IncomeId = await incomeDao.AddAsync(income); } catch (Exception e) { } return(Created("income", income)); }