コード例 #1
0
        public async Task <IActionResult> PutSpending(int id, Spending spending)
        {
            try
            {
                if (id != spending.Id)
                {
                    return(BadRequest());
                }

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

                await _repository.UpdateBalance(spending.BalanceId);

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