public string Delete(shipment_cost shipservice) { string rpta; shipment_cost shipCost = new shipment_cost(); try { using (var ctx = new transshipEntities()) { shipCost = ctx.shipment_cost.FirstOrDefault(x => x.shipmentId == shipservice.shipmentId && x.service_typeId == shipservice.service_typeId && x.measure_unitId == shipservice.measure_unitId); if (shipCost != null) { ctx.Entry(shipCost).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_cost shipservice) { try { BOShipmentCost shipCost = new BOShipmentCost(); var delete = shipCost.Delete(shipservice); return(Request.CreateResponse(HttpStatusCode.OK, delete)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update contact - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public HttpResponseMessage Put(shipment_cost model) { try { BOShipmentCost shipCost = new BOShipmentCost(); shipment_cost ship; ship = shipCost.update(model); return(Request.CreateResponse(HttpStatusCode.OK, ship)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update shipment service - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public shipment_cost Save(shipment_cost model) { var shipCost = new shipment_cost(); try { using (var ctx = new transshipEntities()) { shipCost = ctx.shipment_cost.Add(model); ctx.SaveChanges(); return(shipCost); } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public shipment_cost update(shipment_cost model) { shipment_cost shipCost = new shipment_cost(); shipCost = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(shipCost).State = EntityState.Modified; ctx.SaveChanges(); return(shipCost); } } 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_cost model) { return(shipCost.Delete(model)); }
public shipment_cost update(shipment_cost model) { return(shipCost.update(model)); }
public shipment_cost Save(shipment_cost model) { return(shipCost.Save(model)); }