예제 #1
0
        public SingleObjectModel WhatIfCompleted(string projectUID, string activityUID,
                                                 [FromBody] object body)
        {
            try {
                base.RequireBody(body);
                var bodyAsJson = JsonObject.Parse(body);

                var project = Project.Parse(projectUID);

                Activity activity = project.GetActivity(activityUID);

                DateTime completedDate = bodyAsJson.Get <DateTime>("completedDate", DateTime.Today);

                WhatIfResult result = ModelingServices.WhatIfCompleted(activity, completedDate, true);

                return(new SingleObjectModel(this.Request, result.ToResponse(),
                                             typeof(WhatIfResult).FullName));
            } catch (Exception e) {
                throw base.CreateHttpException(e);
            }
        }