Esempio n. 1
0
        public async Task AddAsync()
        {
            try
            {
                if (!Employees.Any(x => x.Value == true))
                {
                    _notSelected = true;
                    return;
                }

                var employeeIds = Employees.Where(x => x.Value).Select(x => x.Key.Id).ToList();

                await GroupService.AddEmployeesToGroupAsync(employeeIds, GroupId);

                await ToastService.ShowToastAsync("Employee added.", ToastType.Success);

                await SynchronizationService.UpdateGroupDetails(ExceptPageId, GroupId);

                await ModalDialogService.CloseAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
Esempio n. 2
0
        public async Task DeleteAsync()
        {
            try
            {
                await GroupService.RemoveEmployeeFromGroupAsync(GroupMembership.Id);

                await SynchronizationService.UpdateGroupDetails(ExceptPageId, GroupId);

                await ToastService.ShowToastAsync("Employee removed.", ToastType.Success);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
            }
            finally
            {
                await ModalDialogService.CloseAsync();
            }
        }