public void Put(int id, [FromBody] GestionTransporte gestion) { var target = dbContext.GestionTransporte.SingleOrDefault(a => a.Id_Gestion == id); if (target != null && ModelState.IsValid) { dbContext.Entry(target).CurrentValues.SetValues(gestion); dbContext.SaveChanges(); } }
public void Post([FromBody] GestionTransporte gestion) { dbContext.GestionTransporte.Add(gestion); dbContext.SaveChanges(); }