public async Task <IActionResult> PutTipoInstrumento(long id, TipoInstrumento tipoInstrumento) { if (id != tipoInstrumento.Id) { return(BadRequest()); } _context.Entry(tipoInstrumento).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoInstrumentoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> PostProgramacion(IFormCollection data) { int code; string message; try { //Guardar objeto en la base de datos Programaciones p = new Programaciones() { Ano = int.Parse(data["ano"]), Fecha = DateTime.Now, IdEquipo = long.Parse(data["idEquipo"]), IdEstado = long.Parse(data["idEstado"]), IdUsuario = long.Parse(data["idUsuario"]), Observaciones = data["observaciones"], Semana = int.Parse(data["semana"]), }; _context.Programaciones.Add(p); await _context.SaveChangesAsync(); code = 1; message = "OK"; return(Ok(new { code, message })); } catch (Exception ex) { code = 1; message = "ERROR " + ex.Message; return(Ok(new { code, message })); } }
public async Task <IActionResult> PutCalibraciones(long id, Calibraciones calibraciones) { if (id != calibraciones.Id) { return(BadRequest()); } _context.Entry(calibraciones).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CalibracionesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> PostTiposData(IFormCollection data) { int code; string message; try { //Guardar objeto en la base de datos TiposData td = new TiposData() { IdTipo = int.Parse(data["idTipo"]), Descripcion = data["descripcion"] }; _context.TiposData.Add(td); await _context.SaveChangesAsync(); code = 1; message = "OK"; return(Ok(new { code, message })); } catch (Exception ex) { code = 1; message = "ERROR " + ex.Message; return(Ok(new { code, message })); } }