コード例 #1
0
        public async Task <IActionResult> Put([FromRoute] string id, [FromBody] object document)
        {
            var permission = await authorization.AuthorizeAsync(User, new ObjectId(id), new IsOwnerPolicyRequirements());

            if (!permission.Succeeded)
            {
                return(Forbid());
            }

            var res = await cont.Edit(id, document.ToString());

            if (res.HasValue)
            {
                if (res.Value)
                {
                    return(Ok());
                }
                else
                {
                    return(Conflict());
                }
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #2
0
        public async Task <IActionResult> Put([FromRoute] string id, [FromBody] string document)
        {
            var res = await cont.Edit(id, document);

            if (res.HasValue)
            {
                if (res.Value)
                {
                    return(Ok());
                }
                else
                {
                    return(Conflict());
                }
            }
            else
            {
                return(NotFound());
            }
        }