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) }); } }
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) }); } }