public HttpResponseMessage Post(Register_Employee newRegister) { try { if (newRegister == null) { throw new HttpResponseException(AddRequest(HttpStatusCode.BadRequest, "parameter is empty")); } ClaimsPrincipal p = RequestContext.Principal as ClaimsPrincipal; int id = RegisterDA.AddRegister(newRegister, p.Claims); HttpResponseMessage response = new HttpResponseMessage(); string url = string.Format("{0}{1}", HttpContext.Current.Request.Url.ToString(), id); response.Headers.Location = new Uri(url); response.StatusCode = HttpStatusCode.Created; return(response); } catch { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }