// POST api/user /// <summary> /// Creates a new user /// </summary> /// <param name="user"> /// The user data in JSON or XML format /// </param> /// <returns></returns> public HttpResponseMessage PostUser(UserData user) { int ID = user.Save(); var response = Request.CreateResponse<UserData>(HttpStatusCode.Created, user); string url = VirtualPathUtility.AppendTrailingSlash(Request.RequestUri.AbsoluteUri) + ID; response.Headers.Location = new Uri(url); return response; }
// PUT api/user/5 /// <summary> /// Updates an existing user /// </summary> /// <param name="user"> /// The user data in JSON or XML format /// </param> public void PutUser(UserData user) { user.Save(); }