public ActionResult Create([Bind(Include = "ID,Tipo,Preco")] Veiculo veiculo) { if (ModelState.IsValid) { db.Veiculos.Add(veiculo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(veiculo)); }
public IActionResult Create([FromBody] Veiculo item) { if (item == null) { return(BadRequest()); } _context.veiculo.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetVeiculo", new { placa = item.placa }, item)); }
public void AtualizarVeiculo(VeiculoDB veiculo) { _dbContext.Entry(veiculo).State = EntityState.Modified; _dbContext.SaveChanges(); }
public void AtualizarMarca(Marca marca) { _dbContext.Entry(marca).State = EntityState.Modified; _dbContext.SaveChanges(); }
public void AtualizarModelo(ModeloDB modelo) { _dbContext.Entry(modelo).State = EntityState.Modified; _dbContext.SaveChanges(); }
protected void Update <ModelType>(ModelType model) where ModelType : ModelBase { _context.Entry(model).State = EntityState.Modified; _context.SaveChanges(); }