public async Task <HttpResponseMessage> PutMantenimientoPredictivo(MantenimientoPredictivo MantenimientoPredictivo) { try { _mantenimientoPredictivo = await db.MantenimientoPredictivo.FindAsync(MantenimientoPredictivo.IdMantenimientoPredictivo); if (_mantenimientoPredictivo == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { _mantenimientoPredictivo.Fecha = MantenimientoPredictivo.Fecha; _mantenimientoPredictivo.IdArea = MantenimientoPredictivo.IdArea; _mantenimientoPredictivo.IdUnidad = MantenimientoPredictivo.IdUnidad; await db.SaveChangesAsync(); return(new HttpResponseMessage(HttpStatusCode.OK)); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }
public async Task <HttpResponseMessage> GetMantenimientoPredictivo(IdModelMantenimientoPredictivo Id) { try { _mantenimientoPredictivo = await db.MantenimientoPredictivo.FindAsync(Id.IdMantenimientoPredictivo); if (_mantenimientoPredictivo == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(JsonConvert.SerializeObject(_mantenimientoPredictivo), System.Text.Encoding.UTF8, "application/json") }); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }
public async Task <HttpResponseMessage> DeleteMantenimientoPredictivo(IdModelMantenimientoPredictivo Id) { try { _mantenimientoPredictivo = await db.MantenimientoPredictivo.FindAsync(Id.IdMantenimientoPredictivo); if (_mantenimientoPredictivo == null) { return(new HttpResponseMessage(HttpStatusCode.NoContent)); } else { db.Entry(_mantenimientoPredictivo).State = EntityState.Modified; await db.SaveChangesAsync(); return(new HttpResponseMessage(HttpStatusCode.OK)); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }
protected override void Dispose(bool disposing) { if (disposing) { _mantenimientosPredictivo = null; _mantenimientoPredictivo = null; db.Dispose(); } base.Dispose(disposing); }
public async Task <HttpResponseMessage> PostMantenimientoPredictivo(MantenimientoPredictivo MantenimientoPredictivo) { try { db.MantenimientoPredictivo.Add(MantenimientoPredictivo); await db.SaveChangesAsync(); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(ex.Message) }); } }