public AdminSharedModel CreateAdmin(AdminSharedModel admin) { var request = new RestRequest("/admin", Method.POST, DataFormat.Json); request.AddJsonBody(admin); var response = _client.Execute(request); var statusCode = (int)response.StatusCode; if (statusCode != 200) { return(null); } return(JsonConvert.DeserializeObject <AdminSharedModel>(response.Content)); }
public bool EditAdmin(AdminSharedModel admin) { var request = new RestRequest("/admin/{admin_id}", Method.PATCH, DataFormat.Json); request.AddJsonBody(admin); request.AddUrlSegment("admin_id", admin.Id); var response = _client.Execute(request); var statusCode = response.StatusCode; if ((int)statusCode != 200) { return(false); } return(true); }