//[EnableCors("SiteCorsPolicy")]
        public async Task <IActionResult> PutStatus([FromRoute] int id, [FromBody] Estabelecimento status)
        {
            if (id != status.seq)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("seq, razao_social, nome_fantasia, cnpj, email, endereco, cidade, estado, telefone, categoria, status, conta, agencia")] Estabelecimento estabelecimento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(estabelecimento);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(estabelecimento));
        }
Example #3
0
        public async Task <IActionResult> CriaOuEDita([Bind("estabelecimentoId,razaoSocial,nome,cnpj,email,endereco,cidade,estado,telefone,dataCadastro,categoria,status,agencia,conta")] estabelecimento estabelecimento)
        {
            if (ModelState.IsValid)
            {
                if (estabelecimento.estabelecimentoId == 0)
                {
                    _context.Add(estabelecimento);
                }
                else
                {
                    _context.Update(estabelecimento);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(estabelecimento));
        }
Example #4
0
        public async Task <IActionResult> PutEstabelecimento([FromBody] Estabelecimento estabelecimento)
        {
            _context.Entry(estabelecimento).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EstabelecimentoExists(estabelecimento.seq))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutCategoria([FromBody] Categoria categoria)
        {
            _context.Entry(categoria).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategoriaExists(categoria.seq))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }