Пример #1
0
        public async Task <ActionResult <EnderecoCobranca> > PostEnderecoCobranca(EnderecoCobranca enderecoCobranca)
        {
            _context.EnderecosCobranca.Add(enderecoCobranca);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEnderecoCobranca", new { id = enderecoCobranca.EnderecoId }, enderecoCobranca));
        }
Пример #2
0
        public async Task <IActionResult> PutEnderecoCobranca(int id, EnderecoCobranca enderecoCobranca)
        {
            if (id != enderecoCobranca.EnderecoId)
            {
                return(BadRequest());
            }

            _context.Entry(enderecoCobranca).State = EntityState.Modified;

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

            return(NoContent());
        }