예제 #1
0
        public async Task <IActionResult> PutSale(long id, Sale sale)
        {
            if (id != sale.Id)
            {
                return(BadRequest());
            }

            _repository.Update(sale);

            try
            {
                await _repository.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_repository.Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }