コード例 #1
0
ファイル: ShipmentDAL.cs プロジェクト: alonzoalden/freight
        public Shipment CreateShipment(ShipmentInsert shipment)
        {
            using (SqlConnection connection = new SqlConnection(DefaultConnection))
            {
                DynamicParameters p = new DynamicParameters();
                p.Add("businessid", shipment.BusinessID);
                p.Add("shipperid", shipment.ShipperID);
                p.Add("customerid", shipment.CustomerID);
                p.Add("originffw", shipment.OriginFFW);
                p.Add("origin3pl", shipment.Origin3PL);
                p.Add("destinationffw", shipment.DestinationFFW);
                p.Add("destination3pl", shipment.Destination3PL);
                p.Add("hblnumber", shipment.HBLNumber);
                p.Add("mblnumber", shipment.MBLNumber);
                p.Add("containernumber", shipment.ContainerNumber);
                p.Add("etd", shipment.ETD);
                p.Add("eta", shipment.ETA);
                p.Add("txl", shipment.TXL);
                p.Add("isffiled", shipment.ISFFiled);
                p.Add("deliverylocationid", shipment.DeliveryLocationID);
                p.Add("status", shipment.Status);
                p.Add("memo", shipment.Memo);
                p.Add("shipperreference", shipment.ShipperReference);
                p.Add("createdby", shipment.CreatedBy);

                Shipment result = connection.Query <Shipment>("spCreateShipment", p, commandType: CommandType.StoredProcedure).Single();

                return(result);
            }
        }
コード例 #2
0
ファイル: ShipmentBAL.cs プロジェクト: alonzoalden/freight
        public Shipment CreateShipment(ShipmentInsert shipment)
        {
            //Default
            if (string.IsNullOrEmpty(shipment.Status))
            {
                shipment.Status = "Pending";
            }

            return(ShipmentDAL.CreateShipment(shipment));
        }
コード例 #3
0
 public IActionResult CreateShipment(ShipmentInsert shipment)
 {
     try
     {
         return(new JsonResult(ShipmentBAL.CreateShipment(shipment)));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to create Shipment"));
     }
 }