public CircuitConfigurationViewModel GetMainData(CircuitConfigurationViewModel model = null) { if (model == null) { DateTime defaultdate = new DateTime(DateTime.Now.Year, 10, 1); model = new CircuitConfigurationViewModel(); model.CircuitStartDate = defaultdate.ToShortDateString(); } var allCourts = lookupService.GetCourts(); if (IsAuthenticatied && CurrentUser.CourtID != null) { model.AllJudges = UserService.GetAllJudges(CurrentUser.CourtID.Value); model.AllSecretaries = UserService.GetAllSecretaries(CurrentUser.CourtID.Value); model.CourtName = allCourts.Where(x => x.ID == CurrentUser.CourtID.Value).Select(courtid => courtid.Name).Single(); model.AllPoliceStation = lookupService.GetPoliceStationsByCourtID(CurrentUser.CourtID.Value); } else { model.AllCourts = allCourts.ToList(); } model.Circuits = CircuitService.GetCircuits(); model.AllCrimes = lookupService.GetCrimeTypes(); model.CrimeType = (int)Enum_CrimeType.Normal; model.AllCycles = lookupService.GetAllCycles(); return(model); }