Exemplo n.º 1
0
        public async Task <IActionResult> PutBudget(Guid id, BudgetForCreateDto budget)
        {
            if (id != budget.Id)
            {
                return(BadRequest());
            }

            if (!await _budgetRepository.EntryExists(id))
            {
                return(NotFound());
            }

            var budgetToUpdate = await _budgetRepository.GetById(id);

            var updatedBudget = Mapper.Map(budget, budgetToUpdate);

            await _budgetRepository.Update(id, updatedBudget);

            return(NoContent());
        }