コード例 #1
0
        public IHttpActionResult CreateDeliveryAppointmentDutchNed([FromBody] DutchNedDeliveryAppointment data, string apiKey)
        {
            try
            {
                // Check the api key
                var user = _userRepository.GetByUsername(User.Identity.Name);
                if (user.ApiKey != apiKey)
                {
                    return(Unauthorized());
                }

                var deliveryAppointment = new DeliveryAppointment()
                {
                    Carrier                   = "999068",
                    SalesOrderLineId          = data.OrderLineId,
                    DeliveryAppointmentStatus = data.Status,
                    TransactionDate           = DateTime.Parse(data.Date, null, System.Globalization.DateTimeStyles.RoundtripKind),
                };

                _deliveryAppointmentRepository.Insert(deliveryAppointment);

                return(Ok(deliveryAppointment));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #2
0
ファイル: DataTest.cs プロジェクト: Profilan/APIWoood
        public void InsertDeliveryAppointment()
        {
            var rep = new DeliveryAppointmentRepository();

            var status = new DeliveryAppointment()
            {
                Carrier                   = "999068",
                SalesOrderLineId          = 0,
                DeliveryAppointmentStatus = 200,
                TransactionDate           = DateTime.Now,
            };

            rep.Insert(status);
        }