public HttpResponseMessage DeleteDetailRefaction(IdModelMantenimientoPredictivoDetails id) { MantenimientoPredictivoRefaccion guia = new MantenimientoPredictivoRefaccion(); try { if (id != null) { guia = db.MantenimientoPredictivoRefaccion.Where(x => x.IdMantenimientoPredictivoRefaccion == id.IdMantenimientoPredictivoRefaction).FirstOrDefault(); if (guia != null) { db.MantenimientoPredictivoRefaccion.Remove(guia); } db.SaveChanges(); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = null }); } else { return new HttpResponseMessage(System.Net.HttpStatusCode.NoContent) { Content = null } }; } catch (Exception ex) { return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "BackLog")); } }
public HttpResponseMessage CreateDetailRefection(MantenimientoPredictivoRefactionModel guiam) { MantenimientoPredictivoRefaccion mantenimientoPredictivo = new MantenimientoPredictivoRefaccion(); try { if (guiam != null) { mantenimientoPredictivo.IdActividadMantenimientoPredictivo = guiam.IdActividadMantenimientoPredictivo; mantenimientoPredictivo.IdDetalleMantenimientoPredictivo = guiam.IdDetalleMantenimientoPredictivo; mantenimientoPredictivo.IdRefaccion = guiam.IdReFaccion; mantenimientoPredictivo.Cantidad = guiam.Cantidad; db.MantenimientoPredictivoRefaccion.Add(mantenimientoPredictivo); db.SaveChanges(); return(new HttpResponseMessage(System.Net.HttpStatusCode.OK) { Content = null }); } else { return new HttpResponseMessage(System.Net.HttpStatusCode.NoContent) { Content = null } }; } catch (Exception ex) { return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "BackLog")); } }