private void OnModifyStudent() { if (UserSource.Count == 0) { return; } var lastStudent = UserSource.Last(); lastStudent.Remark = $"该同学于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}被修改了备注"; }
private void OnDeleteStudentAsync() { if (UserSource.Count == 0) { return; } var lastStudent = UserSource.Last(); UserSource.Remove(lastStudent); }
private async void OnDeleteData() { if (UserSource.Count == 0) { return; } var lastUser = UserSource.Last(); var result = await CustomDataApi.DeleteCustomDataAsync(_tableName, new[] { lastUser._id }); if (!result.IsOk) { Mg.Get <IMgDialog>().ShowDesktopAlert("删除最后一个学生数据失败", result.Message); return; } Refresh(); }
private async void OnUpdateData() { if (UserSource.Count == 0) { return; } var lastUser = UserSource.Last(); var record = lastUser.AsDictionary().As <DynamicRecord>(); record["Remark"] = $"于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}被修改了备注信息"; var data = new List <IRecord> { record }; var result = await CustomDataApi.UpdateCustomDataAsync(_tableName, data.ToArray()); if (!result.IsOk) { Mg.Get <IMgDialog>().ShowDesktopAlert("修改最后一个学生的备注信息失败", result.Message); return; } Refresh(); }