コード例 #1
0
        public async Task <ActionResult <TodoUser> > GetTodoUser(String nick, String password)
        {
            await Db.Connection.OpenAsync();

            var query  = new UserPostQuery(Db);
            var result = await query.FindOneAsync(nick, password);

            JsonConvert.SerializeObject(result);
            if (result is null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(result));
        }
コード例 #2
0
        public async Task <IActionResult> PutTodoUser(String nick, String password, [FromQuery] TodoUser todoUser)
        {
            await Db.Connection.OpenAsync();

            var query  = new UserPostQuery(Db);
            var result = await query.FindOneAsync(nick, password);

            if (result is null)
            {
                return(new NotFoundResult());
            }

            result.Nick = todoUser.Nick;
            await result.UpdateAsync();

            JsonConvert.SerializeObject(result);
            return(new OkObjectResult(result));
        }