public async Task <ActionResult <unite> > Postunite(unite unite) { _context.unites.Add(unite); await _context.SaveChangesAsync(); return(CreatedAtAction("Getunite", new { id = unite.Id }, unite)); }
public async Task <IActionResult> Putunite(int id, unite unite) { if (id != unite.Id) { return(BadRequest()); } _context.Entry(unite).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!uniteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public bool allerEn(int distance, int speed, unite u) { String commande; bool retour = false; byte[] buffer = new byte[100]; distance = (int)(5.695 * distance);// 6.5 * init(); start(mode.drive); speed = speed * (int)unite.kmh;//* (int)unite.kmh; if (m_port.IsOpen) { commande = "D,p" + distance.ToString() + "s" + speed.ToString() + "\r\n"; buffer = System.Text.Encoding.UTF8.GetBytes(commande); m_port.Write(buffer, 0, commande.Length); } return(retour); }