李昊 4 years ago
parent
commit
682df28aef

+ 24 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminVipEquityController.cs

@@ -21,20 +21,44 @@ namespace GxPress.Api.AdminControllers
         {
             this.vipEquityRepository = vipEquityRepository;
         }
+        /// <summary>
+        /// 获取列表
+        /// </summary>
+        /// <returns></returns>
         [HttpGet]
         public async Task<IEnumerable<VipEquityResult>> GetAllAsync()
         {
             return await vipEquityRepository.GetAllAsync();
         }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
         [HttpPut]
         public async Task<bool> UpdateAsync(VipEquityUpdateRequest request)
         {
             return await vipEquityRepository.UpdateAsync(request);
         }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
         [HttpPost]
         public async Task<bool> InsertAsync(Entity.tede2.VipEquity.VipEquity model)
         {
             return await vipEquityRepository.InsertAsync(model);
         }
+        /// <summary>
+        /// 根据ID删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await vipEquityRepository.DeleteAsync(id);
+        }
     }
 }

+ 11 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/VipEquity/VipEquityRepository.cs

@@ -34,10 +34,10 @@ namespace GxPress.Repository.Implement.VipEquity
         public async Task<IEnumerable<VipEquityResult>> GetAllAsync()
         {
             var result = await _repository.GetAllAsync(Q.OrderByDesc(nameof(Entity.tede2.VipEquity.VipEquity.CreatedDate)));
-            var items= result.Select(n => _mapper.Map<VipEquityResult>(n)).ToList();
+            var items = result.Select(n => _mapper.Map<VipEquityResult>(n)).ToList();
             foreach (var item in items)
             {
-                item.VipTypeValue=((GxPress.EnumConst.VipCardTypeConst)item.VipType).GetDescriptionOriginal();
+                item.VipTypeValue = ((GxPress.EnumConst.VipCardTypeConst)item.VipType).GetDescriptionOriginal();
             }
             return items;
         }
@@ -57,5 +57,14 @@ namespace GxPress.Repository.Implement.VipEquity
         {
             return await _repository.InsertAsync(model) > 0;
         }
+        /// <summary>
+        /// 根据Id删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
     }
 }

+ 1 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/VipEquity/IVipEquityRepository.cs

@@ -12,5 +12,6 @@ namespace GxPress.Repository.Interface.VipEquity
 
         Task<bool> UpdateAsync(VipEquityUpdateRequest request);
         Task<bool> InsertAsync(Entity.tede2.VipEquity.VipEquity model);
+        Task<bool> DeleteAsync(int id);
     }
 }