Esempio n. 1
0
        public async Task <IActionResult> PutLoan(int id, ExpenseService.DataAccess.Model.Loan loan)
        {
            if (id != loan.Id)
            {
                return(BadRequest());
            }

            var newLoan = Mapper.MapLoan(loan);

            _repo.Changed(newLoan);

            try
            {
                await _repo.SaveAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!(await LoanExists(id)))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }