[HttpPut("{id}")] // ACTUALIZAR public async Task <IActionResult> PutLote_medicina(int id, Lote_medicina lote_medicina) { if (id != lote_medicina.id_lote) { return(BadRequest()); } dbConexion.Entry(lote_medicina).State = EntityState.Modified; try { await dbConexion.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Lote_medicinaExists(id)) { return(NotFound()); } else { throw; } } return(Ok()); }
[HttpPost] // INSERTAR public async Task <ActionResult <Lote_medicina> > PostLote_medicina(Lote_medicina lote_medicina) { dbConexion.Lote_medicina.Add(lote_medicina); await dbConexion.SaveChangesAsync(); return(CreatedAtAction(nameof(GetLote_medicina), new { id = lote_medicina.id_lote }, lote_medicina)); }