Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions AdminBlazor.Test/Components/Blog/_Article.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="col-12">

<AdminTable2 TItem="Article" Context="item" PageSize="20" Title="随笔文章"DialogClassName="modal-xxl"
OnQuery="OnQuery" InitQuery="InitQuery" OnEdit="OnEdit" OnSave="OnSave">
OnQuery="OnQuery" InitQuery="InitQuery" OnEdit="OnEdit" OnSaving="OnSaving">

<TableHeader>
<th>随笔专栏</th>
Expand Down Expand Up @@ -222,27 +222,14 @@
await Task.Yield();
}

async Task<bool> OnSave(Article item)
async Task OnSaving(AdminConfirmEventArgs<Article> item)
{
//检查必须录入
if (string.IsNullOrWhiteSpace(item.Content))
if (string.IsNullOrWhiteSpace(item.Argument.Content))
{
await JS.Error("提示", "正文必须录入");

return false;
item.Cancel = true;
}

if (item.Id == default)
{
await repo.InsertAsync(item);

}
else
{
if (await JS.Confirm($"确定要修改数据吗?") == false) return false;
await repo.UpdateAsync(item);
}

return true;
}
}