public void Add(MSDS_Composition entity) { if (_context.MSDS_Composition.Any(x => x.CASCode == entity.CASCode || x.Composition_Name == entity.Composition_Name)) { throw new Exception("该组分已经存在!"); } _context.MSDS_Composition.Add(entity); }
public void Add(MSDS_Composition entity) { _repository.Add(entity); }