public override bool Remove(Material material) { try { material = Get(material.MaterialID); if (material != null) { foreach (var reopMaterial in RepositoryMaterialsRepository.Instanse.GetAll( repoMat => repoMat.MaterialID == material.MaterialID)) { RepositoryMaterialsService.Remove(reopMaterial.MaterialID); } LogsService.Instanse.Insert(new Log { HostTable = (short)HostTable.Materials, Details = Log.MaterialDetailer(material, ActionType.Removed) }); MaterialsRepository.Instanse.DeleteAndSubmit(material); return(true); } return(false); } catch (Exception exception) { Logger.Write(exception); return(false); } }
public override bool Remove(Lab lab) { try { lab = Get(lab.LabID); if (lab != null) { foreach (var labProp in LabPropsRepository.Instanse.GetAll(category => category.LabID == lab.LabID)) { LabPropsService.Instanse.Remove(labProp); } foreach (var repositoryMaterial in RepositoryMaterialsRepository.Instanse.GetAll()) { RepositoryMaterialsService.Remove(repositoryMaterial.MaterialID); } LogsService.Instanse.Insert(new Log { HostTable = (short)HostTable.Labs, Details = Log.LabDetailer(lab, ActionType.Removed) }); LabsRepository.Instanse.DeleteAndSubmit(lab); return(true); } return(false); } catch (Exception exception) { Logger.Write(exception); return(false); } }