コード例 #1
0
        public JsonResult addUser(CreateUserRequest user)
        {
            if (!correctUser(user))
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json(ValidationProblem()));
            }
            var newUser = new User(user.name);

            _userDAO.addUser(newUser);
            Response.StatusCode = (int)HttpStatusCode.Created;
            return(Json(Created("api/users", newUser)));
        }