コード例 #1
0
        protected override async Task <bool> DeleteItemAsync(RoleModel model)
        {
            try
            {
                StartStatusMessage("Deleting Role...");
                RoleViewModel.ShowProgressRing();
                await RoleService.DeleteRoleAsync(model);

                ClearItem();
                await RoleListViewModel.RefreshAsync();

                ShowPopup("success", "Role is deleted");
                EndStatusMessage("Role deleted");
                LogWarning("Role", "Delete", "Role deleted", $"Taluk {model.RoleId} '{model.Name}' was deleted.");
                return(true);
            }
            catch (Exception ex)
            {
                ShowPopup("error", "Role is not deleted");
                StatusError($"Error deleting Role: {ex.Message}");
                LogException("Role", "Delete", ex);
                return(false);
            }
            finally {
                RoleViewModel.HideProgressRing();
            }
        }
コード例 #2
0
        //public ExpenseHeadDetailsArgs CreateArgs()
        //{
        //    return new ExpenseHeadDetailsArgs
        //    {
        //        ExpenseHeadId = Item?.ExpenseHeadId ?? 0
        //    };
        //}


        protected override async Task <bool> SaveItemAsync(RoleModel model)
        {
            try
            {
                if (IsProcessing)
                {
                    return(false);
                }
                IsProcessing = true;
                StartStatusMessage("Saving Role...");
                RoleViewModel.ShowProgressRing();
                if (model.RoleId <= 0)
                {
                    await RoleService.AddRoleAsync(model);
                }
                else
                {
                    await RoleService.UpdateRoleAsync(model);
                }
                ClearItem();
                await RoleListViewModel.RefreshAsync();

                IsProcessing = false;
                ShowPopup("success", "Role is Saved");
                EndStatusMessage("Role saved");
                LogInformation("Role", "Save", "Role saved successfully", $"Role {model.RoleId} '{model.Name}' was saved successfully.");
                return(true);
            }
            catch (Exception ex)
            {
                IsProcessing = false;
                ShowPopup("error", "Role is not Saved");
                StatusError($"Error saving Role: {ex.Message}");
                LogException("Role", "Save", ex);
                return(false);
            }
            finally {
                RoleViewModel.HideProgressRing();
            }
        }