Example #1
0
        public async Task <IActionResult> Put(string id, [FromBody][Required] string text, CancellationToken ct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var value = new Value {
                Id = id, Text = text
            };
            var result = await _valueStore.UpdateAsync(value, ct);

            if (result.MatchedCount == 0)
            {
                return(NotFound());
            }

            return(Ok(value));
        }