public void Delete(int ID) { Category org = Get(ID); if (org == null) { throw new Exception($"Category Not Exist"); } var mp = new MProducts(); var uc = GetUNCategory().ID; foreach (var item in mp.Get_All()) { if (item.Category_ID == ID) { item.Category_ID = uc; mp.Update(item); } } Management.Remove(org); }
public void Delete(int id) { Producer org = Get(id); if (org == null) { throw new Exception($"Producer Not Exist"); } var mp = new MProducts(); var up = Get_All().Where(i => i.Name.CompareTo("Unknown") == 0).First().ID; foreach (var item in mp.Get_All()) { if (item.Producer_ID == id) { item.Producer_ID = up; mp.Update(item); } } Management.Remove(org); }