コード例 #1
0
        public override async void Save()
        {
            try
            {
                if (GridModel == null)
                {
                    return;
                }
                if (string.IsNullOrWhiteSpace(GridModel.UserName) ||
                    string.IsNullOrWhiteSpace(GridModel.Account) ||
                    string.IsNullOrWhiteSpace(GridModel.Password))
                {
                    Msg.Warning("请填写必填项目!");
                    return;
                }
                UpdateLoading(true, "正在保存用户信息...");
                var r = await service.SaveUserAsync(GridModel);

                if (r.success)
                {
                    await GetPageData(1);

                    base.Save();
                }
                else
                {
                    UpdateLoading(false);
                    Msg.Error(r.message);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
            }
            finally
            {
                UpdateLoading(false);
            }
        }