RemoveClass.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Data;
  5. using System.Text.RegularExpressions;
  6. using MySystem.Models;
  7. using Library;
  8. namespace MySystem
  9. {
  10. public class RemoveClass
  11. {
  12. public static void DeletePosMachineList(string key, int Id)
  13. {
  14. List<PosMachineList> list = RedisDbconn.Instance.GetList<PosMachineList>(key, 1, 1000000);
  15. PosMachineList item = list.FirstOrDefault(m => m.Id == Id);
  16. if(item != null)
  17. {
  18. list.Remove(item);
  19. }
  20. RedisDbconn.Instance.Clear(key);
  21. RedisDbconn.Instance.AddList(key, list.ToArray());
  22. }
  23. public static void DeletePosMachines(string key, int Id)
  24. {
  25. List<PosMachines> list = RedisDbconn.Instance.GetList<PosMachines>(key, 1, 1000000);
  26. PosMachines item = list.FirstOrDefault(m => m.Id == Id);
  27. if(item != null)
  28. {
  29. list.Remove(item);
  30. }
  31. RedisDbconn.Instance.Clear(key);
  32. RedisDbconn.Instance.AddList(key, list.ToArray());
  33. }
  34. }
  35. }