Esempio n. 1
0
        public async Task <IActionResult> PutIncome(int id, Income income)
        {
            try
            {
                if (id != income.Id)
                {
                    return(BadRequest());
                }

                if (await _repository.Update(income) == null)
                {
                    return(BadRequest());
                }

                await _repository.UpdateBalance(income.BalanceId);

                return(NoContent());
            }
            catch (Exception)
            {
                if (!_repository.Exist(id))
                {
                    return(NotFound());
                }
                else
                {
                    return(BadRequest());
                }
            }
        }