Ejemplo n.º 1
0
        public void DeleteIndustry(IndustryEntity newEntity)
        {
            IndustryEntity oldEntity = IndustryList.FirstOrDefault <IndustryEntity>(p => p.IndustryId == newEntity.IndustryId);

            if (oldEntity != null)
            {
                IndustryList.Remove(oldEntity);
            }

            IndustryList = new List <IndustryEntity>(_industryList);
        }
Ejemplo n.º 2
0
        public void AddOrUpdateIndustry(IndustryEntity newEntity)
        {
            IndustryEntity oldEntity = IndustryList.FirstOrDefault <IndustryEntity>(p => p.Description == newEntity.Description);

            if (oldEntity == null)
            {
                IndustryList.Insert(0, newEntity);
            }
            else
            {
                int index = IndustryList.IndexOf(oldEntity);
                IndustryList.Remove(oldEntity);
                IndustryList.Insert(index, newEntity);
            }

            IndustryList = new List <IndustryEntity>(_industryList);
        }