public string Delete(shipment_tracking tracking) { string rpta; shipment_tracking shipTrack = new shipment_tracking(); try { using (var ctx = new transshipEntities()) { shipTrack = ctx.shipment_tracking.FirstOrDefault(x => x.shipmentId == tracking.shipmentId && x.trackingId == tracking.trackingId && x.userId == tracking.userId); if (shipTrack != null) { ctx.Entry(shipTrack).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public HttpResponseMessage Delete(shipment_tracking shipservice) { try { BOShipmentTracking shipTracking = new BOShipmentTracking(); var delete = shipTracking.Delete(shipservice); return(Request.CreateResponse(HttpStatusCode.OK, delete)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to delete tracking - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public HttpResponseMessage Put(shipment_tracking model) { try { BOShipmentTracking shipTracking = new BOShipmentTracking(); shipment_tracking ship; ship = shipTracking.update(model); return(Request.CreateResponse(HttpStatusCode.OK, ship)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update tracking - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public shipment_tracking Save(shipment_tracking model) { var shipTrack = new shipment_tracking(); try { using (var ctx = new transshipEntities()) { shipTrack = ctx.shipment_tracking.Add(model); ctx.SaveChanges(); return(shipTrack); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public shipment_tracking update(shipment_tracking model) { shipment_tracking shipTrack = new shipment_tracking(); shipTrack = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(shipTrack).State = EntityState.Modified; ctx.SaveChanges(); return(shipTrack); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public string Delete(shipment_tracking model) { return(shipTracking.Delete(model)); }
public shipment_tracking update(shipment_tracking model) { return(shipTracking.update(model)); }
public shipment_tracking Save(shipment_tracking model) { return(shipTracking.Save(model)); }