public HttpResponseMessage SaveRepresentative(string username) { String DepID = Data_Users.GetDepRepbyName(username); //getting DEP id of the Department Users u = Data_Users.GetUserInfo(username); Users DepRepInfo = Data_Users.GetDepRepInfo(DepID); int prev_DepRep = DepRepInfo.UserID; //Getting Previous Dep Rep ID int Confirm = Data_Users.AssignRepresentative(u.UserID); //Setting New Representative to Department if (Confirm != 0) { Data_Users.RemoveRepresentative(prev_DepRep); //Removing the Previous Representative of the Department } var message = Request.CreateResponse(HttpStatusCode.Created, "Successfully updated!"); return(message); }