예제 #1
0
        public RestApiResult Update(long id, JObject json)
        {
            Wagon wagon = ClarityDB.Instance.Wagons.FirstOrDefault(x => x.ID == id);

            if (wagon == null)
            {
                return(new RestApiResult {
                    StatusCode = HttpStatusCode.NotFound
                });
            }

            wagon.ApplyJson(json);
            UpdateWagonSettlementsFromJson(wagon.ID, json);

            ClarityDB.Instance.SaveChanges();

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