wangyuhan 1 рік тому
батько
коміт
53edf36b2e

+ 10 - 3
src/PTCMS.API/PTCMS.API/Controllers/CertificateController.cs

@@ -3,6 +3,7 @@
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 
+using PTCMS.API.Domain.Entities;
 using PTCMS.API.Domain.Repositories;
 using PTCMS.API.Infrastructure.Dtos;
 
@@ -35,13 +36,19 @@ namespace PTCMS.API.Controllers
         /// <param name="input"></param>
         /// <returns></returns>
         [HttpPost]
-        public async Task<IActionResult> GetCertificateAsync(CertificateSearchDto input)
+        public async Task<IActionResult> GetCertificateAsync([FromBody] CertificateSearchDto input)
         {
             try
             {
+                var list = new List<Certificate>();
                 var data = await _certificateRepository.GetCertificateAsync(input);
 
-                return Ok(data);
+                if (data != null)
+                {
+                    list.Add(data);
+                }
+
+                return Ok(list);
             }
             catch (Exception ex)
             {
@@ -84,7 +91,7 @@ namespace PTCMS.API.Controllers
                 {
                     return BadRequest(ex.Message);
                 }
-               
+
             };
 
             return BadRequest("目前只支持jpg和png格式");