示例#1
0
        public RestApiResult Create(JObject json)
        {
            if (json == null)
            {
                return(new RestApiResult {
                    StatusCode = HttpStatusCode.BadRequest
                });
            }

            Wagon wagon = Wagon.FromJson(json);

            wagon.CreatedDate = DateTime.Now;

            ClarityDB.Instance.Wagons.Add(wagon);
            ClarityDB.Instance.SaveChanges();

            AddWagonSettlementsFromJson(wagon.ID, json);

            return(new RestApiResult {
                StatusCode = HttpStatusCode.OK
            });
        }