示例#1
0
        public IActionResult UpdateUser(UpdateUserQuery query)
        {
            var user = _users.FirstOrDefault(e => e.Id == query.Id);

            if (user != null)
            {
                user.Login = query.Login;
            }

            return(Ok());
        }
示例#2
0
        public async Task <IActionResult> UpdateUser(int id, User user)
        {
            if (!UserExist(id))
            {
                return(Content($"User with id no. {id} not found"));
            }

            var query  = new UpdateUserQuery(user);
            var result = await _mediator.Send(query);

            return(Content($"Successfuly updated user with id no. {user.Id}"));
        }