diff --git a/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs b/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs index 72a75df..53a6d71 100644 --- a/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs +++ b/New_College.Api/Controllers/Front/SeVolunteerInitializationController.cs @@ -26,10 +26,11 @@ namespace New_College.Api.Controllers /// 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下 /// private readonly ID_SeVolunteerInitializationServices _d_SeVolunteerInitializationServices; - - public SeVolunteerInitializationController(ID_SeVolunteerInitializationServices D_SeVolunteerInitializationServices) + private readonly ISysRegionServices _sysRegionServices; + public SeVolunteerInitializationController(ID_SeVolunteerInitializationServices D_SeVolunteerInitializationServices, ISysRegionServices sysRegionServices) { _d_SeVolunteerInitializationServices = D_SeVolunteerInitializationServices; + _sysRegionServices = sysRegionServices; } @@ -40,17 +41,20 @@ namespace New_College.Api.Controllers [HttpGet] public async Task>> Get() { + var sysregion = await _sysRegionServices.Query(e => e.Level == 1); var data = new MessageModel>(); - var sevolunterlist = (await _d_SeVolunteerInitializationServices.Query(E=>E.IsDelete==false)).Select(c => new SeVolunterInitializationDto() + var sevolunterlist = (await _d_SeVolunteerInitializationServices.Query(E => E.IsDelete == false)).Select(c => new SeVolunterInitializationDto() { AllScore = c.AllScore, IsOpen = c.IsOpen, ProvinceName = c.ProvinceName, Policy = c.PolicyType, Years = c.Years, - Code = c.Id - + Code = sysregion.Where(e => e.RegionName == c.ProvinceName).FirstOrDefault().RegionCode }).ToList(); + + + int nowyear = DateTime.Now.Year; int month = DateTime.Now.Month; sevolunterlist.ForEach(a => diff --git a/New_College.Model/ViewModels/SeVolunterInitializationDto.cs b/New_College.Model/ViewModels/SeVolunterInitializationDto.cs index c799ddf..bb9b739 100644 --- a/New_College.Model/ViewModels/SeVolunterInitializationDto.cs +++ b/New_College.Model/ViewModels/SeVolunterInitializationDto.cs @@ -7,7 +7,7 @@ namespace New_College.Model public class SeVolunterInitializationDto { - public int Code { get; set; } + public string Code { get; set; } public string ProvinceName { get; set; } ///