Ejemplo n.º 1
0
        [ActionName("Create")]  //POST
        public HttpResponseMessage Post(SSPUser user)
        {
            //check if user exists
            if (SSPUser.GetUserById(user.UserID).UserID != null)
            {
                var       message = string.Format("User with UserID = {0} already exists", user.UserID);
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.NotFound, err));
            }
            else
            {
                SSPUser.CreateUser(user);

                var message = string.Format("User with UserID = {0} already exists", user.UserID);
                //HttpError err = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.OK, "User created"));
            }
        }
Ejemplo n.º 2
0
 // GET api/<controller>/5
 public SSPUser GetUserById(string UserID)
 {
     return(SSPUser.GetUserById(UserID));
 }