public async Task <IActionResult> View(int noteId) { ViewNoteView model = new ViewNoteView(); var note = await _notesService.GetNoteByIdAsync(noteId); if (note.DepartmentId != DepartmentId) { Unauthorized(); } model.Note = note; model.Department = await _departmentsService.GetDepartmentByIdAsync(note.DepartmentId); return(View(model)); }
public IActionResult View(int noteId) { ViewNoteView model = new ViewNoteView(); var note = _notesService.GetNoteById(noteId); if (note.DepartmentId != DepartmentId) { Unauthorized(); } model.Note = note; model.Department = _departmentsService.GetDepartmentById(note.DepartmentId); return(View(model)); }