diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs index 80d8ad25..7e1717f4 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs @@ -106,7 +106,7 @@ public class Ghre_SurveyController : BaseController /// [HttpPost("SubmitESSData/{openClassId}/{id}")] - public async Task SubmitESSDataFromOpenCLass(long id, [FromBody] Ghre_SurveyExtend input, long openClassId) => await _service.SubmitESSData(id, input); + public async Task SubmitESSDataFromOpenCLass(long id, [FromBody] Ghre_SurveyExtend input, long openClassId) => await _service.SubmitESSData(id, input, openClassId); #endregion diff --git a/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs index b6bda78a..2cefe8ed 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs @@ -18,7 +18,7 @@ public interface IGhre_SurveyServices : IBaseServices> QueryESSData(long id, long? openClassId = null); - Task SubmitESSData(long id, Ghre_SurveyExtend input); + Task SubmitESSData(long id, Ghre_SurveyExtend input, long? openClassId = null); Task Publish(long id); diff --git a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs index 88c6ed1a..52fb1681 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs @@ -280,13 +280,14 @@ public class Ghre_SurveyServices : BaseServices SubmitESSData(long id, Ghre_SurveyExtend input) + public async Task SubmitESSData(long id, Ghre_SurveyExtend input, long? openClassId = null) { var entity = await base.QueryById(id); var lastRecord = await Db.Queryable() .Where(x => x.StaffId == App.User.StaffId && x.SurveyId == id) + .WhereIF(openClassId != null, x => x.OpenClassId == openClassId) .FirstAsync(); var surveyRecordId = lastRecord?.Id; await Db.Updateable() @@ -318,7 +319,8 @@ public class Ghre_SurveyServices : BaseServices