コード例 #1
0
        public async Task <IActionResult> Put(string id, [FromBody] Movie value)
        {
            using (var ct = new MoviesDataController())
            {
                Guid guid;
                if (!Guid.TryParse(id, out guid)) // validates id is a guid
                {
                    return(StatusCode((int)System.Net.HttpStatusCode.ExpectationFailed));
                }

                bool ok = await ct.UpdateMovieAsync(guid, value);

                if (ok)
                {
                    return(Ok());
                }
                else
                {
                    return(Conflict());
                }
            }
        }