AdminVipEquityController.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Repository.Interface.VipEquity;
  4. using GxPress.Request.VipEquity;
  5. using GxPress.Result.VipEquity;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. namespace GxPress.Api.AdminControllers
  9. {
  10. /// <summary>
  11. /// VIP权益
  12. /// </summary>
  13. [Route("api/admin/vip-equity")]
  14. [ApiController]
  15. [Authorize]
  16. public class AdminVipEquityController : Controller
  17. {
  18. private readonly IVipEquityRepository vipEquityRepository;
  19. public AdminVipEquityController(IVipEquityRepository vipEquityRepository)
  20. {
  21. this.vipEquityRepository = vipEquityRepository;
  22. }
  23. /// <summary>
  24. /// 获取列表
  25. /// </summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public async Task<IEnumerable<VipEquityResult>> GetAllAsync()
  29. {
  30. return await vipEquityRepository.GetAllAsync();
  31. }
  32. /// <summary>
  33. /// 修改
  34. /// </summary>
  35. /// <param name="request"></param>
  36. /// <returns></returns>
  37. [HttpPut]
  38. public async Task<bool> UpdateAsync(VipEquityUpdateRequest request)
  39. {
  40. return await vipEquityRepository.UpdateAsync(request);
  41. }
  42. /// <summary>
  43. /// 添加
  44. /// </summary>
  45. /// <param name="model"></param>
  46. /// <returns></returns>
  47. [HttpPost]
  48. public async Task<bool> InsertAsync(Entity.tede2.VipEquity.VipEquity model)
  49. {
  50. return await vipEquityRepository.InsertAsync(model);
  51. }
  52. /// <summary>
  53. /// 根据ID删除
  54. /// </summary>
  55. /// <param name="id"></param>
  56. /// <returns></returns>
  57. [HttpDelete("{id}")]
  58. public async Task<bool> DeleteAsync(int id)
  59. {
  60. return await vipEquityRepository.DeleteAsync(id);
  61. }
  62. }
  63. }