Example #1
0
        public void ChangeLotTags(int LotId, List <Tag> SelectedTags)
        {
            var LotTags = DataBase.GetProductTags(LotId);
            var Tags    = DataBase.GetTags();

            foreach (var item in Tags)
            {
                var NowChecked = SelectedTags.Where(x => x.Id == item.Id).FirstOrDefault() != null;
                var WasChecked = LotTags.Where(x => x.Id == item.Id).FirstOrDefault() != null;

                if (!NowChecked && WasChecked)
                {
                    DataBase.DeleteConnectTagToLot(item.Id, LotId);
                }
                if (NowChecked && !WasChecked)
                {
                    DataBase.AddConnectTagToLot(item.Id, LotId);
                }
            }
        }