示例#1
0
        public ActionResult updateUser(long id, [FromBody] UserItem user)
        {
            //TODO Check if user is allowed to update this item

            if (userDB.getUserItem(id) == null)
            {
                return(NotFound("No UserItem found for ID: " + id));
            }
            user.UserID = id;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            user = userDB.editUserItem(id, user);
            return(Ok(user));
        }