public void Update_indisponivel(int id) { Livro livro = _context.Livro.FirstOrDefault(l => l.Id == id); if (!_context.Livro.Any(s => s.Id == livro.Id)) { Console.WriteLine("Id not found"); } livro.Disponibilidade = "Indisponivel"; _context.Update(livro); _context.SaveChanges(); }
public void Update(Cliente cliente) { if (!_context.Cliente.Any(s => s.Id == cliente.Id)) { Console.WriteLine("Id not found"); } _context.Update(cliente); _context.SaveChanges(); }
public void Update(Estoque estoque) { if (!_context.Estoque.Any(s => s.Id == estoque.Id)) { Console.WriteLine("Id not found"); } _context.Update(estoque); _context.SaveChanges(); }
public void Update(Nota nota) { if (!_context.Nota.Any(s => s.Id == nota.Id)) { Console.WriteLine("Id not found"); } _context.Update(nota); _context.SaveChanges(); }
public async Task <IActionResult> Edit(long?id, [Bind("LivroId,Titulo,Preco,Disponivel")] Livro livro) { if (id != livro.LivroId) { return(NotFound()); } if (ModelState.IsValid) { try { contexto.Update(livro); await contexto.SaveChangesAsync(); } catch (DbUpdateException) { ModelState.AddModelError("", "Não foi possível alterar os dados."); } return(RedirectToAction("Index")); } return(View(livro)); }
public async Task <IActionResult> Edit(long?id, [Bind("EditoraId,Nome,Site")] Editora editora) { if (id != editora.EditoraId) { return(NotFound()); } if (ModelState.IsValid) { try { contexto.Update(editora); await contexto.SaveChangesAsync(); } catch (DbUpdateException) { ModelState.AddModelError("", "Não foi possível alterar os dados."); } return(RedirectToAction("Index")); } return(View(editora)); }
public virtual void Update(TEntity entity) { _Db.Update(entity); }