private ActionResult RenderDayView(DateTime?from, DateTime?to, List <NoteTypeModel> noteTypes) { DateTime selectedDate; var selectedDateCookie = GetCookie(_selectedDateCookie); if (selectedDateCookie == null) { selectedDate = DateTime.Now.Date; SetCookie(_selectedDateCookie, selectedDate.ToString("o")); } else { selectedDate = DateTime.Parse(selectedDateCookie).Date; } List <Note> notes; if (from.HasValue && to.HasValue) { if (from.Value <= selectedDate && selectedDate <= to.Value) { notes = _noteService.GetAll(selectedDate, selectedDate, noteTypes); } else { notes = new List <Note>(); } } else { if (!from.HasValue && !to.HasValue) { notes = _noteService.GetAll(selectedDate, selectedDate, noteTypes); } else if (from.HasValue && from.Value <= selectedDate) { notes = _noteService.GetAll(selectedDate, selectedDate, noteTypes); } else if (to.HasValue && to.Value >= selectedDate) { notes = _noteService.GetAll(selectedDate, selectedDate, noteTypes); } else { notes = new List <Note>(); } } notes = notes.OrderBy(note => note.DateTime).ToList(); var noteModels = NoteMapper.Map(notes); var list = new DayViewModeModel() { SelectedDate = selectedDate, Notes = noteModels, }; return(PartialView("Diary/ViewModes/Day", list)); }
public void should_play_c_when_swing_at_85() { var playingDevice = new Mock <IPlayingDevice>(); var mapper = new NoteMapper(90, playingDevice.Object); mapper.Map(0, 85, MovingDir.Left); playingDevice.Verify(c => c.PlayNote(Midi.Pitch.C0)); }
public void should_play_nothing_above_85() { var playingDevice = new Mock <IPlayingDevice>(); var mapper = new NoteMapper(90, playingDevice.Object); mapper.Map(0, 90, MovingDir.Left); playingDevice.Verify(c => c.PlayNote(Midi.Pitch.C0), Times.Never); }
public ActionResult AddNote(NoteViewModel viewModel) { if (ModelState.IsValid) { Service.Add(NoteMapper.Map(viewModel)); } return(GetUserNotes()); }
private ActionResult RenderListView(DateTime?from, DateTime?to, List <NoteTypeModel> noteTypes) { var notes = _noteService.GetAll(from, to, noteTypes); notes = notes.OrderBy(note => note.DateTime).ToList(); var noteModels = NoteMapper.Map(notes); var list = new ListViewModeModel() { Notes = noteModels }; return(PartialView("Diary/ViewModes/List", list)); }