Example #1
0
        public async Task <Observation> CreateObservationAsync(
            [GraphQLType(typeof(CreateObservationInputType))][GraphQLName("input")]
            CreateObservationCommand input, [Service] ISheaftMediatr mediatr,
            ObservationsByIdBatchDataLoader dataLoader, CancellationToken token)
        {
            var result = await ExecuteAsync <CreateObservationCommand, Guid>(mediatr, input, token);

            return(await dataLoader.LoadAsync(result, token));
        }
Example #2
0
        public async Task <IActionResult> PostAsync([FromBody] ObservationDTO observation)
        {
            //return _observationService.Save(observation);
            var command = new CreateObservationCommand
            {
                Id                 = 0,
                Discussion         = observation.Discussion,
                DiscussionDate     = observation.DiscussionDate,
                DiscussionLocation = observation.DiscussionLocation,
                DiscussionWith     = observation.DiscussionWith,
                Subject            = observation.Subject,
                Outcome            = observation.Outcome,
                RecordedBy         = observation.RecordedBy,
                RecordedDate       = observation.RecordedDate
            };
            var result = await Mediator.Send(command);

            return(Ok(result));
        }