protected async Task SaveRow(DepartmentModel model) { var result = await DepartmentApiClient.UpdateDepartment(model); if (result) { NotificationService.Notify(new NotificationMessage { Summary = "Department updated", Duration = 5000, Severity = NotificationSeverity.Success }); } await DepartmentsGrid.UpdateRow(model); }
protected async Task DeleteDepartment(DepartmentModel model) { var result = await DepartmentApiClient.DeleteDepartment(model.Id); if (result) { NotificationService.Notify(new NotificationMessage { Summary = "Department deleted", Duration = 5000, Severity = NotificationSeverity.Info }); Departments = Departments.Where(departmentModel => departmentModel.Id != model.Id).ToList(); await InvokeAsync(StateHasChanged); } }
protected async Task Submit(DepartmentModel model) { IsResponseAwaiting = true; var result = await DepartmentApiClient.CreateDepartment(model); if (result.isSuccess) { NotificationService.Notify(new NotificationMessage { Duration = 5000, Severity = NotificationSeverity.Success, Summary = "Department created" }); } IsResponseAwaiting = false; DialogService.Close(new DepartmentModel { Id = result.Id, Title = model.Title, Users = new List <UserModel>() }); }
private async Task LoadData() { Departments = await DepartmentApiClient.GetDepartments(); IsInitialized = true; }