private void DeleteEquipmentRelation(Guid equipmentId, Guid componentId) { EquipmentComponentRelation relation = _unitOfWork .EquipmentComponentRelations .Find(r => r.EquipmentId == equipmentId && r.ComponentId == componentId) .FirstOrDefault(); if (relation != null) { Delete(relation.Id); } }
public void Add(EquipmentComponentRelationDTO relationDTO) { EquipmentComponentRelation relation = Mapper.Map <EquipmentComponentRelation>(relationDTO); relation.Id = Guid.NewGuid(); relation.CreatedAt = DateTime.Now; relation.UpdatedAt = DateTime.Now; relation.IsActual = false; _unitOfWork.EquipmentComponentRelations.Create(relation); _unitOfWork.Save(); }
public void Delete(Guid id) { EquipmentComponentRelation relation = _unitOfWork.EquipmentComponentRelations.Get(id); if (relation == null) { throw new NotFoundException(); } _unitOfWork.EquipmentComponentRelations.Delete(id); _unitOfWork.Save(); }
public EquipmentComponentRelationDTO Get(Guid id) { EquipmentComponentRelation relation = _unitOfWork.EquipmentComponentRelations.Get(id); return(Mapper.Map <EquipmentComponentRelationDTO>(relation)); }