Пример #1
0
        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);
        }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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));
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
 public string Delete(shipment_cost model)
 {
     return(shipCost.Delete(model));
 }
Пример #7
0
 public shipment_cost update(shipment_cost model)
 {
     return(shipCost.update(model));
 }
Пример #8
0
 public shipment_cost Save(shipment_cost model)
 {
     return(shipCost.Save(model));
 }