From 3b890baa6cdb1976e91e59820e501fe3418da933 Mon Sep 17 00:00:00 2001 From: zhangyousheng Date: Sat, 29 Jul 2023 19:14:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/UserPoint.cs | 2 +- .../Pages/UserPointPage/UserPointManage.razor | 44 +++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/UserPointManagement.Model/Entities/UserPoint.cs b/src/UserPointManagement.Model/Entities/UserPoint.cs index b8b2470..1359b09 100644 --- a/src/UserPointManagement.Model/Entities/UserPoint.cs +++ b/src/UserPointManagement.Model/Entities/UserPoint.cs @@ -14,6 +14,6 @@ public class UserPoint { UserId = userId; Point = point; - CreateTime = DateTime.Now; + CreateTime = DateTime.UtcNow; } } \ No newline at end of file diff --git a/src/UserPointManagement.Web/Pages/UserPointPage/UserPointManage.razor b/src/UserPointManagement.Web/Pages/UserPointPage/UserPointManage.razor index a72e116..aa6a35f 100644 --- a/src/UserPointManagement.Web/Pages/UserPointPage/UserPointManage.razor +++ b/src/UserPointManagement.Web/Pages/UserPointPage/UserPointManage.razor @@ -4,6 +4,9 @@ @using System.Text.Json @using global::UserPointManagement.Model.Dtos.User @using global::UserPointManagement.Model.Dtos.UserPoint +@using UserPointManagement.Application.Services +@inject IUserPointService UserPointService; + @@ -45,6 +48,36 @@ + +
+ + + + + + +
+
+ @code { #region original form coding @@ -52,9 +85,10 @@ public class Model { [Required] - public string Name { get; set; } + public int UserId { get; set; } - public string Mobile { get; set; } + [Required] + public int Point { get; set; } } private Model model = new Model(); @@ -111,7 +145,11 @@ private async Task HandleOk(MouseEventArgs e) { _form.Submit(); - // TODO: 添加积分 + await UserPointService.CreateUserPoint(new CreateUserPointDto() + { + UserId = model.UserId, + Point = model.Point + }).ConfigureAwait(false); await RefreshTable().ConfigureAwait(false); }