LayuiModel.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. namespace DllEapEntity.Dtos
  6. {
  7. public class LayuiModel<T>
  8. {
  9. public LayuiModel()
  10. {
  11. }
  12. public LayuiModel(int count, IEnumerable<T> datas)
  13. {
  14. this.count = count;
  15. this.data = datas;
  16. }
  17. public int code { get; set; } = 1;
  18. public string msg { get; set; }
  19. public int count { get; set; }
  20. public int extra { get; set; }
  21. public IEnumerable<T> data { get; set; }
  22. public object extraObject { get; set; }
  23. /// <summary>
  24. /// 创建空列表
  25. /// </summary>
  26. /// <param name="error"></param>
  27. /// <returns></returns>
  28. public static LayuiModel<T> CreateEmptyList(string error = null)
  29. {
  30. var temp = new LayuiModel<T> { code = 1, data = null, count = 0 };
  31. if (!string.IsNullOrEmpty(error))
  32. {
  33. temp.code = -1;
  34. temp.msg = error;
  35. }
  36. return temp;
  37. }
  38. }
  39. }