using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Text.RegularExpressions;
using MySystem.Models;
using Library;

namespace MySystem
{
    public class RemoveClass
    {
        public static void DeletePosMachineList(string key, int Id)
        {
            List<PosMachineList> list = RedisDbconn.Instance.GetList<PosMachineList>(key, 1, 1000000);
            PosMachineList item = list.FirstOrDefault(m => m.Id == Id);
            if(item != null)
            {
                list.Remove(item);
            }
            RedisDbconn.Instance.Clear(key);
            RedisDbconn.Instance.AddList(key, list.ToArray());
        }

        public static void DeletePosMachines(string key, int Id)
        {
            List<PosMachines> list = RedisDbconn.Instance.GetList<PosMachines>(key, 1, 1000000);
            PosMachines item = list.FirstOrDefault(m => m.Id == Id);
            if(item != null)
            {
                list.Remove(item);
            }
            RedisDbconn.Instance.Clear(key);
            RedisDbconn.Instance.AddList(key, list.ToArray());
        }
    }
}
