If using Navigatiomanager null value exception came while using in Class file
NavigationManager navigationManager;
  public ICollection<TimeOff> GetTimeOffbyStaff(int id)
    {
      ICollection<TimeOff> timeOff = new List<TimeOff>();
      try
      {
        timeOff = labOrgDbContext.TimeOff.Include(x => x.Technologist).Where(x => x.TechnologistId == id && x.FromDate >= (DateTime.Now.AddYears(-1)).Date && x.IsDeleted != true).OrderByDescending(x => x.RowInsertOn).ToList();
      }
      catch (Exception ex)
      {
        ExceptionLogging.SendErrorToText(ex, "1");
        navigationManager.NavigateTo("/PagenotFound");
        throw ex;
      }
      return timeOff;
    }
 
     
    