public async Task <IHttpActionResult> PutNoteSettings(int id, NoteSettings noteSettings) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != noteSettings.Id) { return(BadRequest()); } db.Entry(noteSettings).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoteSettingsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetNoteSettings(int id) { NoteSettings noteSettings = await db.NoteSettings.FindAsync(id); if (noteSettings == null) { return(NotFound()); } return(Ok(noteSettings)); }
public async Task <IHttpActionResult> PostNoteSettings(NoteSettings noteSettings) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NoteSettings.Add(noteSettings); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = noteSettings.Id }, noteSettings)); }
public async Task <IHttpActionResult> DeleteNoteSettings(int id) { NoteSettings noteSettings = await db.NoteSettings.FindAsync(id); if (noteSettings == null) { return(NotFound()); } db.NoteSettings.Remove(noteSettings); await db.SaveChangesAsync(); return(Ok(noteSettings)); }
/// <summary> /// For debugging the what the list of notes contain /// </summary> // void CheckNotes() // { // foreach(Note curnote in notes) // { // Debug.Log("Lenght:"+curnote.GetLength()); // Debug.Log("Beat:"+curnote.GetBeat()); // Debug.Log("Button:"+curnote.GetButtonType()); // } // } // void SetNote(int currentnoteindex, int replacementnoteindex) // { // newnote = new Note(); // newnote.SetLength(NotesText[replacementnoteindex].Length); // newnote.SetButtonType(System.Convert.ToInt32(NotesText[replacementnoteindex].Substring(0, 1))); // newnote.SetBeat(SoundController.soundcontroller.GetBeatfromList(MusicListText[replacementnoteindex].Substring(0, 1))); // notes[currentnoteindex] = newnote; // } void StoreNotes(int index) { NoteSettings note = new NoteSettings(NotesText[index].Length, (beatList)SoundController.soundcontroller.GetBeatfromList(MusicListText[index].Substring(0, 1)), (buttonType)System.Convert.ToInt32(NotesText[index].Substring(0, 1))); noteSettings.Add(note); }
Note CreateNote(NoteSettings settings, float angle) { if (settings == null) restart = true; note = AvailableNotes [0]; note.NoteSetting = settings; Quaternion rotation = note.transform.rotation; Vector3 eulerAngles = rotation.eulerAngles; eulerAngles.y = angle; rotation.eulerAngles = eulerAngles; note.transform.rotation = rotation; note.gameObject.SetActive (true); Notes.Add (note); AvailableNotes.RemoveAt (0); noteManager.currentNoteIndex++; return note; }