public void AddNote(int casino, int id, [FromBody] NotePostData data) { if (data == null) { throw new Exception("Missing Note Data"); } string sql = "INSERT INTO PlayerNote (PlayerID, StaffID, Content) VALUES(@PlayerID, @StaffID, @Content)"; _data.Save(sql, new { PlayerID = id, data.StaffID, data.Content }); }
public async void AddNote(int casino, int staff_id, int player_id, string note) { var data = new NotePostData { StaffID = staff_id, Content = note, }; var content = new StringContent(JsonConvert.SerializeObject(data), System.Text.Encoding.UTF8, "application/json"); using (var http = GetHttpClient()) { var r = await http.PostAsync(casino + "/player/" + player_id + "/notes", content); if (!r.IsSuccessStatusCode) { throw new Exception(r.ReasonPhrase); } } }