protected async Task HandleValidSubmit() { LecturerGroupDto result = null; if (LecturerGroup.LecturerGroupId != 0) { result = await LecturerGroupService.UpdateLecturerGroup(LecturerGroup); } else { result = await LecturerGroupService.CreateLecturerGroup(LecturerGroup); } NavigationManager.NavigateTo($"/lecturergroupsview"); }
/// <summary> /// inside this method we call the rest api and retrieve a data /// </summary> /// <returns></returns> protected async override Task OnInitializedAsync() { int.TryParse(Id, out int planId); if (planId != 0) { Plan = await PlanService.GetPlan(int.Parse(Id)); AutumnSemester = Plan.AutumnSemester; SpringSemester = Plan.SpringSemester; Semesters = new List <SemesterDto> { AutumnSemester, SpringSemester }; SemesterId = Semester.SemesterId.ToString(); ModuleId = Module.ModuleId.ToString(); Lmr = new LecturerModuleRunDto(); SelectedPlanId = Plan.Id; ListLmr = (await LecturerModuleRunService.GetLecturerModuleRuns()).ToList(); foreach (var sem in Semesters) { foreach (var mr in sem.ModuleRuns) { ModuleRuns.Add(mr); } } await ShowLastYearPlan(); } else { Plan = new PlanDto { }; Semester = new SemesterDto { }; Module = new ModuleDto { }; ListLmr = new List <LecturerModuleRunDto> { }; } Plans = (await PlanService.GetPlans()).ToList(); ModuleRuns = (await ModuleRunService.GetModuleRuns()).ToList(); Modules = (await ModuleService.GetModules()).ToList(); Lecturers = (await LecturerService.GetLecturers()).ToList(); LecturerGroups = (await LecturerGroupService.GetLecturerGroups()).ToList(); }
protected async override Task OnInitializedAsync() { int.TryParse(Id, out int lecturerGroupId); if (lecturerGroupId != 0) { PageHeaderText = "Edit LecturerGroup"; LecturerGroup = await LecturerGroupService.GetLecturerGroup(int.Parse(Id)); } else { PageHeaderText = "Create LecturerGroup"; LecturerGroup = new LecturerGroupDto { }; } Lecturers = (await LecturerService.GetLecturers()).ToList(); }
protected async Task Delete_Click() { await LecturerGroupService.DeleteLecturerGroup(LecturerGroup.LecturerGroupId); NavigationManager.NavigateTo("/"); }