Procházet zdrojové kódy

新客户资料删除方法

wangh před 1 rokem
rodič
revize
74bb38580f

+ 25 - 0
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -1,5 +1,6 @@
 using Microsoft.AspNetCore.Mvc;
 using OASystem.Domain.Dtos.CRM;
+using OASystem.Domain.Entities.Customer;
 using OASystem.Infrastructure.Repositories.CRM;
 using static OASystem.Domain.Dtos.CRM.NewClientDataQueryDto;
 
@@ -61,6 +62,30 @@ namespace OASystem.API.Controllers
                 throw;
             }
         }
+        /// <summary>
+        /// 新客户资料操作(删除)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> NewClientDel(DelBaseDto dto)
+        {
+            try
+            {
+                var res = await _clientDataRepository.SoftDeleteByIdAsync<Crm_NewClientData>(dto.Id.ToString(), dto.DeleteUserId);
+                if (!res)
+                {
+                    return Ok(JsonView(false, "删除失败"));
+                }
+                return Ok(JsonView(true, "删除成功!"));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+        }
 
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]