Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,IdSupplier,Code,Name,Description,FiscalCode,Specie,CreatedAt,CreatedBy,UpdatedAt,UpdatedBy")] Material material)
        {
            if (id != material.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(material);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterialExists(material.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(material));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,CNPJ,CEP,QRCode,RegisterDate")] Supplier supplier)
        {
            if (id != supplier.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supplier);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupplierExists(supplier.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(supplier));
        }