Пример #1
0
        public async Task <IActionResult> PutEndereco(long id, Endereco endereco)
        {
            if (id != endereco.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Cep1,Logradouro,Complemento,Bairro,Localidade,Uf,Unidade,Ibge,Gia")] Cep cep)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cep);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cep));
        }