Example #1
0
        public async Task <ActionResult <FileFormModel> > Patch([FromRoute][Required] string id,
                                                                [FromBody][Required] JsonPatchDocument <FileFormModel> doc)
        {
            if (!await Repo.Any(id))
            {
                return(NotFound());
            }

            var eDoc = doc.CloneFor <FileFormModel, FileEntity>();

            var e = await Repo.Patch(id, eDoc, ServiceProvider.GetRequiredService <IAdapterFactory>());

            return(Ok(GetPatchResponseModel2(e)));
        }
        public virtual async Task <ActionResult <ModelResponse <TFm> > > Patch([FromRoute][Required] string id,
                                                                               [FromBody][Required] JsonPatchDocument <TFm> doc)
        {
            if (!await Repo.Any(id))
            {
                return(NotFound());
            }

            var eDoc = doc.CloneFor <TFm, TE>();

            await OnPatching(id, eDoc);

            var e = await Repo.Patch(id, eDoc, ServiceProvider.GetRequiredService <IAdapterFactory>());

            await OnPatched(e);

            return(Ok(await GetPatchResponseModel(e)));
        }